Class GeoValue<V>

  • Type Parameters:
    V - Value type.
    All Implemented Interfaces:
    Serializable

    public class GeoValue<V>
    extends Value<V>
    A Geo value extension to Value.
    Since:
    6.1
    Author:
    Mark Paluch
    See Also:
    Serialized Form
    • Constructor Detail

      • GeoValue

        protected GeoValue()
        Serializable constructor.
    • Method Detail

      • from

        public static <T extends V,​V> Value<V> from​(GeoCoordinates coordinates,
                                                          Optional<T> optional)
        Creates a Value from a key and an Optional. The resulting value contains the value from the Optional if a value is present. Value is empty if the Optional is empty.
        Parameters:
        coordinates - the score.
        optional - the optional. May be empty but never null.
        Returns:
        the Value.
      • fromNullable

        public static <T extends V,​V> Value<V> fromNullable​(GeoCoordinates coordinates,
                                                                  T value)
        Creates a Value from a coordinates and value. The resulting value contains the value if the value is not null.
        Parameters:
        coordinates - the coordinates.
        value - the value. May be null.
        Returns:
        the Value.
      • just

        public static <T extends V,​V> GeoValue<V> just​(double longitude,
                                                             double latitude,
                                                             T value)
        Creates a GeoValue from a key and value. The resulting value contains the value.
        Parameters:
        longitude - the longitude coordinate according to WGS84.
        latitude - the latitude coordinate according to WGS84.
        value - the value. Must not be null.
        Returns:
        the GeoValue
      • just

        public static <T extends V,​V> GeoValue<V> just​(GeoCoordinates coordinates,
                                                             T value)
        Creates a GeoValue from a key and value. The resulting value contains the value.
        Parameters:
        coordinates - the coordinates.
        value - the value. Must not be null.
        Returns:
        the GeoValue.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Value<V>
      • map

        public <R> GeoValue<R> map​(Function<? super V,​? extends R> mapper)
        Returns a GeoValue consisting of the results of applying the given function to the value of this element. Mapping is performed only if a value is present.
        Overrides:
        map in class Value<V>
        Type Parameters:
        R - element type of the new GeoValue.
        Parameters:
        mapper - a stateless function to apply to each element.
        Returns:
        the new GeoValue.