Class UnmodifiableBoundedCollection<E>

    • Method Detail

      • unmodifiableBoundedCollection

        public static <E> BoundedCollection<E> unmodifiableBoundedCollection​(BoundedCollection<? extends E> coll)
        Factory method to create an unmodifiable bounded collection.
        Type Parameters:
        E - the type of the elements in the collection
        Parameters:
        coll - the BoundedCollection to decorate, must not be null
        Returns:
        a new unmodifiable bounded collection
        Throws:
        java.lang.NullPointerException - if coll is null
        Since:
        4.0
      • unmodifiableBoundedCollection

        public static <E> BoundedCollection<E> unmodifiableBoundedCollection​(java.util.Collection<? extends E> coll)
        Factory method to create an unmodifiable bounded collection.

        This method is capable of drilling down through up to 1000 other decorators to find a suitable BoundedCollection.

        Type Parameters:
        E - the type of the elements in the collection
        Parameters:
        coll - the BoundedCollection to decorate, must not be null
        Returns:
        a new unmodifiable bounded collection
        Throws:
        java.lang.NullPointerException - if coll is null
        java.lang.IllegalArgumentException - if coll is not a BoundedCollection
        Since:
        4.0
      • iterator

        public java.util.Iterator<Eiterator()
        Specified by:
        iterator in interface java.util.Collection<E>
        Specified by:
        iterator in interface java.lang.Iterable<E>
        Overrides:
        iterator in class AbstractCollectionDecorator<E>
      • isFull

        public boolean isFull()
        Description copied from interface: BoundedCollection
        Returns true if this collection is full and no new elements can be added.
        Specified by:
        isFull in interface BoundedCollection<E>
        Returns:
        true if the collection is full.
      • maxSize

        public int maxSize()
        Description copied from interface: BoundedCollection
        Gets the maximum size of the collection (the bound).
        Specified by:
        maxSize in interface BoundedCollection<E>
        Returns:
        the maximum number of elements the collection can hold.