Class SetMapper<E,​R>

  • All Implemented Interfaces:
    java.lang.Iterable<R>, java.util.Collection<R>, java.util.Set<R>
    Direct Known Subclasses:
    CacheSetMapper

    public class SetMapper<E,​R>
    extends CollectionMapper<E,​R>
    implements java.util.Set<R>
    A set that maps another one to a new one of a possibly different type. Note this set is read only and doesn't accept write operations.

    This class currently only accepts a Function that also implements InjectiveFunction so that it can guarantee the resulting mapped values are distinct from each other. This is important as many operations because very costly if this is not true.

    Some operations such as Collection.contains(Object) and Collection.containsAll(Collection) may be more expensive then normal since they cannot utilize lookups into the original collection.

    Since:
    9.0
    Author:
    wburns
    • Constructor Summary

      Constructors 
      Constructor Description
      SetMapper​(java.util.Set<E> realCollection, java.util.function.Function<? super E,​? extends R> mapper)  
    • Method Summary

      • Methods inherited from class java.util.AbstractCollection

        contains, containsAll, toArray, toArray, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.Set

        add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray
    • Constructor Detail

      • SetMapper

        public SetMapper​(java.util.Set<E> realCollection,
                         java.util.function.Function<? super E,​? extends R> mapper)