Interface Object2ObjectMap.FastEntrySet<K,​V>

All Superinterfaces:
java.util.Collection<Object2ObjectMap.Entry<K,​V>>, java.lang.Iterable<Object2ObjectMap.Entry<K,​V>>, ObjectCollection<Object2ObjectMap.Entry<K,​V>>, ObjectIterable<Object2ObjectMap.Entry<K,​V>>, ObjectSet<Object2ObjectMap.Entry<K,​V>>, java.util.Set<Object2ObjectMap.Entry<K,​V>>
All Known Subinterfaces:
Object2ObjectSortedMap.FastSortedEntrySet<K,​V>
Enclosing interface:
Object2ObjectMap<K,​V>

public static interface Object2ObjectMap.FastEntrySet<K,​V>
extends ObjectSet<Object2ObjectMap.Entry<K,​V>>
An entry set providing fast iteration.

In some cases (e.g., hash-based classes) iteration over an entry set requires the creation of a large number of Map.Entry objects. Some fastutil maps might return entry set objects of type FastEntrySet: in this case, fastIterator() will return an iterator that is guaranteed not to create a large number of objects, possibly by returning always the same entry (of course, mutated), and fastForEach(Consumer) will apply the provided consumer to all elements of the entry set, which might be represented always by the same entry (of course, mutated).

  • Method Summary

    Modifier and Type Method Description
    default void fastForEach​(java.util.function.Consumer<? super Object2ObjectMap.Entry<K,​V>> consumer)
    Iterates quickly over this entry set; the iteration might happen always on the same entry instance, suitably mutated.
    ObjectIterator<Object2ObjectMap.Entry<K,​V>> fastIterator()
    Returns a fast iterator over this entry set; the iterator might return always the same entry instance, suitably mutated.

    Methods inherited from interface java.util.Collection

    parallelStream, removeIf, stream, toArray

    Methods inherited from interface java.lang.Iterable

    forEach

    Methods inherited from interface it.unimi.dsi.fastutil.objects.ObjectSet

    iterator, spliterator

    Methods inherited from interface java.util.Set

    add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
  • Method Details

    • fastIterator

      Returns a fast iterator over this entry set; the iterator might return always the same entry instance, suitably mutated.
      Returns:
      a fast iterator over this entry set; the iterator might return always the same Map.Entry instance, suitably mutated.
    • fastForEach

      default void fastForEach​(java.util.function.Consumer<? super Object2ObjectMap.Entry<K,​V>> consumer)
      Iterates quickly over this entry set; the iteration might happen always on the same entry instance, suitably mutated.

      This default implementation just delegates to Iterable.forEach(Consumer).

      Parameters:
      consumer - a consumer that will by applied to the entries of this set; the entries might be represented by the same entry instance, suitably mutated.
      Since:
      8.1.0