Class CollectionsExt.ImmutableCollection<E>

  • Type Parameters:
    E - the class of the elements of this collection.
    All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>
    Enclosing class:
    CollectionsExt<E>

    public static final class CollectionsExt.ImmutableCollection<E>
    extends CollectionsExt.AbstractImmutableCollection<java.util.Collection<E>,​E>
    implements java.util.Collection<E>
    A collection which prevents being modified by throwing an exception for the modifying methods.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Collection<E> coll
      The enclosed set containing the elements of this set.
    • Constructor Summary

      Constructors 
      Constructor Description
      ImmutableCollection​(java.util.Collection<E> coll)
      Creates a new empty ImmutableCollection which equals coll but cannot be modified neither directly nor via its iterator.
    • Field Detail

      • coll

        private final java.util.Collection<E> coll
        The enclosed set containing the elements of this set.
    • Constructor Detail

      • ImmutableCollection

        ImmutableCollection​(java.util.Collection<E> coll)
        Creates a new empty ImmutableCollection which equals coll but cannot be modified neither directly nor via its iterator.
        Throws:
        java.lang.NullPointerException - if coll==null.