Class UnmodifiableCollectionView<V,​E>

  • Type Parameters:
    V - The type of the view.
    E - The type of the underlying element.
    All Implemented Interfaces:
    java.lang.Iterable<V>, java.util.Collection<V>

    public class UnmodifiableCollectionView<V,​E>
    extends java.util.AbstractCollection<V>
    An unmodifiable view of a collection that maps each element in an underlying collection into a view.
    • Constructor Summary

      Constructors 
      Constructor Description
      UnmodifiableCollectionView​(java.util.function.Function<E,​V> viewer, java.util.Collection<E> elements)
      Constructs an unmodifiable view over collection.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      UnmodifiableCollectionView.ReusableIterator iterator()
      int size()
      • Methods inherited from class java.util.AbstractCollection

        add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, 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

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

        forEach
    • Constructor Detail

      • UnmodifiableCollectionView

        public UnmodifiableCollectionView​(java.util.function.Function<E,​V> viewer,
                                          java.util.Collection<E> elements)
        Constructs an unmodifiable view over collection.
        Parameters:
        viewer - function.
        elements - collection to create a view for.
    • Method Detail

      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<V>
        Specified by:
        size in class java.util.AbstractCollection<V>
      • iterator

        public UnmodifiableCollectionView.ReusableIterator iterator()
        Specified by:
        iterator in interface java.util.Collection<V>
        Specified by:
        iterator in interface java.lang.Iterable<V>
        Specified by:
        iterator in class java.util.AbstractCollection<V>