Class LinkedHashMultimap<K,​V>

    • Method Detail

      • withSeq

        public static <V> LinkedHashMultimap.Builder<V> withSeq()
        Returns a builder for LinkedHashMultimap instances where values are stored in a sequence. Values for each key will be stored in a Vavr List, allowing duplicates and preserving insertion order.
        Type Parameters:
        V - The value type
        Returns:
        A new Builder for creating LinkedHashMultimap instances with sequence-based value storage
      • withSet

        public static <V> LinkedHashMultimap.Builder<V> withSet()
        Returns a builder for LinkedHashMultimap instances where values are stored in a set. Values for each key will be stored in a Vavr HashSet, eliminating duplicates.
        Type Parameters:
        V - The value type
        Returns:
        A new Builder for creating LinkedHashMultimap instances with set-based value storage
      • withSortedSet

        public static <V extends java.lang.Comparable<?>> LinkedHashMultimap.Builder<V> withSortedSet()
        Returns a builder for LinkedHashMultimap instances where values are stored in a sorted set. Values for each key will be stored in a Vavr TreeSet, eliminating duplicates and maintaining natural ordering.
        Type Parameters:
        V - The value type, must be Comparable
        Returns:
        A new Builder for creating LinkedHashMultimap instances with sorted set-based value storage
      • withSortedSet

        public static <V> LinkedHashMultimap.Builder<V> withSortedSet​(@NonNull java.util.Comparator<? super V> comparator)
        Returns a builder for LinkedHashMultimap instances where values are stored in a sorted set with a custom comparator. Values for each key will be stored in a Vavr TreeSet, eliminating duplicates and maintaining order defined by the comparator.
        Type Parameters:
        V - The value type
        Parameters:
        comparator - The comparator to define the ordering of values
        Returns:
        A new Builder for creating LinkedHashMultimap instances with sorted set-based value storage using the given comparator
        Throws:
        java.lang.NullPointerException - if comparator is null
      • narrow

        public static <K,​V> LinkedHashMultimap<K,​V> narrow​(LinkedHashMultimap<? extends K,​? extends V> map)
        Narrows a LinkedHashMultimap<? extends K, ? extends V> to LinkedHashMultimap<K, V> via a type-safe cast. Safe here because the multimap is immutable and no elements can be added that would violate the type (covariance)
        Type Parameters:
        K - the target key type
        V - the target value type
        Parameters:
        map - the multimap to narrow
        Returns:
        the same multimap viewed as LinkedHashMultimap<K, V>
      • emptyMapSupplier

        protected <K2,​V2> Map<K2,​V2> emptyMapSupplier()
        Description copied from class: AbstractMultimap
        Returns an empty Map instance specific to the implementing class.
        Specified by:
        emptyMapSupplier in class AbstractMultimap<K,​V,​LinkedHashMultimap<K,​V>>
        Type Parameters:
        K2 - Key type of the empty map
        V2 - Value type of the empty map
        Returns:
        An empty Map instance
      • emptyInstance

        protected <K2,​V2> LinkedHashMultimap<K2,​V2> emptyInstance()
        Description copied from class: AbstractMultimap
        Returns an empty Multimap instance specific to the implementing class.
        Specified by:
        emptyInstance in class AbstractMultimap<K,​V,​LinkedHashMultimap<K,​V>>
        Type Parameters:
        K2 - Key type of the empty multimap
        V2 - Value type of the empty multimap
        Returns:
        An empty Multimap instance
      • createFromMap

        protected <K2,​V2> LinkedHashMultimap<K2,​V2> createFromMap​(@NonNull Map<K2,​Traversable<V2>> back)
        Description copied from class: AbstractMultimap
        Creates a new Multimap instance from the given backing map.
        Specified by:
        createFromMap in class AbstractMultimap<K,​V,​LinkedHashMultimap<K,​V>>
        Type Parameters:
        K2 - Key type of the new multimap
        V2 - Value type of the new multimap
        Parameters:
        back - The backing map to create the multimap from
        Returns:
        A new Multimap instance containing the entries from the backing map
      • isSequential

        public boolean isSequential()
        Description copied from interface: Traversable
        Indicates whether the elements of this Traversable appear in encounter (insertion) order.
        Specified by:
        isSequential in interface Traversable<K>
        Returns:
        true if insertion order is preserved, false otherwise