Class CollectionStore<T>

  • All Implemented Interfaces:
    java.lang.Iterable<T>, Iterable<T>, Store<T>

    public class CollectionStore<T>
    extends java.lang.Object
    implements Store<T>, Iterable<T>
    A simple collection backed store.
    • Constructor Summary

      Constructors 
      Constructor Description
      CollectionStore​(java.util.Collection<T> collection)
      Basic constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Collection<T> getMatches​(Selector<T> selector)
      Return the matches in the collection for the passed in selector.
      java.util.Iterator<T> iterator()
      Returns an iterator over a set of elements of type T.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • CollectionStore

        public CollectionStore​(java.util.Collection<T> collection)
        Basic constructor.
        Parameters:
        collection - - initial contents for the store, this is copied.
    • Method Detail

      • getMatches

        public java.util.Collection<T> getMatches​(Selector<T> selector)
        Return the matches in the collection for the passed in selector.
        Specified by:
        getMatches in interface Store<T>
        Parameters:
        selector - the selector to match against.
        Returns:
        a possibly empty collection of matching objects.
      • iterator

        public java.util.Iterator<T> iterator()
        Description copied from interface: Iterable
        Returns an iterator over a set of elements of type T.
        Specified by:
        iterator in interface java.lang.Iterable<T>
        Specified by:
        iterator in interface Iterable<T>
        Returns:
        an Iterator.