Class CollectionQuery<T>

  • All Implemented Interfaces:
    Query<T>, Iterable<T>

    public class CollectionQuery<T>
    extends Object
    implements Query<T>
    Author:
    max
    • Constructor Detail

      • CollectionQuery

        public CollectionQuery​(@NotNull
                               Collection<T> collection)
    • Method Detail

      • findAll

        @NotNull
        public Collection<T> findAll()
        Description copied from interface: Query
        Get all of the results in the Collection
        Specified by:
        findAll in interface Query<T>
        Returns:
        results in a collection or empty collection if no results found.
      • findFirst

        public T findFirst()
        Description copied from interface: Query
        Get the first result or null if no results have been found.
        Specified by:
        findFirst in interface Query<T>
        Returns:
        first result of the search or null if no results.
      • forEach

        public boolean forEach​(@NotNull
                               Processor<T> consumer)
        Description copied from interface: Query
        Process search results one-by-one. All the results will be subsequently fed to a consumer passed.
        Specified by:
        forEach in interface Query<T>
        Parameters:
        consumer - - a processor search results should be fed to.
        Returns:
        true if the search was completed normally, false if the occurrence processing was cancelled by the processor.
      • toArray

        public T[] toArray​(T[] a)
        Specified by:
        toArray in interface Query<T>