Class ReadOnlyCollectionFacade<E>

java.lang.Object
org.jhotdraw8.icollection.readonly.AbstractReadOnlyCollection<E>
org.jhotdraw8.icollection.facade.ReadOnlyCollectionFacade<E>
Type Parameters:
E - the element type
All Implemented Interfaces:
Iterable<E>, ReadOnlyCollection<E>
Direct Known Subclasses:
ReadOnlySequencedCollectionFacade

public class ReadOnlyCollectionFacade<E> extends AbstractReadOnlyCollection<E>
Provides a ReadOnlyCollection facade to a set of Collection functions.
Author:
Werner Randelshofer
  • Field Details

    • iteratorFunction

      protected final Supplier<Iterator<E>> iteratorFunction
    • sizeFunction

      protected final IntSupplier sizeFunction
    • containsFunction

      protected final Predicate<Object> containsFunction
    • characteristics

      protected final int characteristics
  • Constructor Details

    • ReadOnlyCollectionFacade

      public ReadOnlyCollectionFacade(Supplier<Iterator<E>> iteratorFunction, @Nullable IntSupplier sizeFunction, Predicate<Object> containsFunction, int characteristics)
    • ReadOnlyCollectionFacade

      public ReadOnlyCollectionFacade(Collection<E> c)
  • Method Details

    • size

      public int size()
      Description copied from interface: ReadOnlyCollection
      Returns the size of the collection.
      Returns:
      the size
    • contains

      public boolean contains(Object o)
      Description copied from interface: ReadOnlyCollection
      Returns true if this collection contains the specified object.
      Specified by:
      contains in interface ReadOnlyCollection<E>
      Overrides:
      contains in class AbstractReadOnlyCollection<E>
      Parameters:
      o - an object
      Returns:
      true if this collection contains the specified object
    • iterator

      public Iterator<E> iterator()
      Description copied from interface: ReadOnlyCollection
      Returns an iterator over the elements in this collection.
      Returns:
      an iterator
    • spliterator

      public Spliterator<E> spliterator()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object