Class LazyBagOnCollection<E>

  • Type Parameters:
    E -
    All Implemented Interfaces:
    java.lang.Iterable<E>, java.util.Collection<E>

    public class LazyBagOnCollection<E>
    extends LazyBag<E>
    LazyBag that passes method calls through to the underlying Collection, where possible, instead of going via Iterators.
    • Constructor Detail

      • LazyBagOnCollection

        public LazyBagOnCollection​(java.util.Collection<E> dataSource)
        Creates a new LazyBagOnCollection around dataSource.
        Parameters:
        dataSource - the underlying collection
    • Method Detail

      • iterator

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

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<E>
        Overrides:
        contains in class LazyCollection<E>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<E>
        Overrides:
        isEmpty in class LazyCollection<E>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E>
        Overrides:
        size in class LazyCollection<E>