Interface MapWrapper<K,​V>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void addAll​(Iterable<? extends V> iterable)
      add all elements of iterable
      void clear()
      Clear all entries from map
      MapWrapper<K,​V> clone()
      Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created
      boolean contains​(V value)
      Check if value is already present
      V findFirst​(Predicate<V> valuePredicate)
      Find first entry that matches the predicate
      default <T extends V>
      void
      forEachIn​(Collection<T> values, Consumer<T> consumer)
      apply provided consumer to each element in values as long as that element is registered on this wrapper
      V get​(K key)
      Collect entry from container
      default V getFirst()
      collect the first entry based on the iterator's result, which is not necessarily the fist entry ordered by the key, it is just the first entry the iterator would provide
      K getKeyByValue​(V value)
      collect the key used for the given value
      boolean isEmpty()
      Verify if the map is empty
      V register​(V value)
      Register on the internal container
      V remove​(V value)
      Remove value from map
      int size()
      The number of registered entries
      Collection<V> toCollection()
      Collect values as unmodifiable collection
      Set<V> valuesAsNewSet()
      Create a copy of the map's distinct values as a set
    • Method Detail

      • register

        V register​(V value)
        Register on the internal container
        Parameters:
        value - to register
        Returns:
        old value if any
      • remove

        V remove​(V value)
        Remove value from map
        Parameters:
        value - to remove
        Returns:
        removed entry if any
      • clear

        void clear()
        Clear all entries from map
      • get

        V get​(K key)
        Collect entry from container
        Parameters:
        key - to use
        Returns:
        value for key
      • size

        int size()
        The number of registered entries
        Returns:
        number of entries
      • isEmpty

        boolean isEmpty()
        Verify if the map is empty
        Returns:
        true when empty false otherwise
      • contains

        boolean contains​(V value)
        Check if value is already present
        Parameters:
        value - to verify
        Returns:
        true if present, false otherwise
      • toCollection

        Collection<V> toCollection()
        Collect values as unmodifiable collection
        Returns:
        collection
      • valuesAsNewSet

        Set<V> valuesAsNewSet()
        Create a copy of the map's distinct values as a set
        Returns:
        copt of values as set
      • findFirst

        V findFirst​(Predicate<V> valuePredicate)
        Find first entry that matches the predicate
        Parameters:
        valuePredicate - that checks a property of the value and the first which matches is returned
        Returns:
        the retrieved entry, or null if no traveler type was found
      • clone

        MapWrapper<K,​V> clone()
        Each map wrapper should be cloneable where the contents are references of the original where possible but the underlying map itself is newly created
        Returns:
        copy
      • getKeyByValue

        K getKeyByValue​(V value)
        collect the key used for the given value
        Parameters:
        value - to collect used key for
        Returns:
        key
      • getFirst

        default V getFirst()
        collect the first entry based on the iterator's result, which is not necessarily the fist entry ordered by the key, it is just the first entry the iterator would provide
        Returns:
        first iterable entry, null if empty
      • addAll

        default void addAll​(Iterable<? extends V> iterable)
        add all elements of iterable
        Parameters:
        iterable - to add elements of
      • forEachIn

        default <T extends V> void forEachIn​(Collection<T> values,
                                             Consumer<T> consumer)
        apply provided consumer to each element in values as long as that element is registered on this wrapper
        Type Parameters:
        T - type of values
        Parameters:
        values - to apply consumer to when they are registered in this wrapper
        consumer - to apply