Class CollectionResult<T>

All Implemented Interfaces:
Iterable<T>, IQueryable<T>, IQueryResult<T>

public class CollectionResult<T> extends Object implements IQueryResult<T>
This class allows to adapt java collections to a p2 a query result and as such something queryable
  • Constructor Details

    • CollectionResult

      public CollectionResult(Collection<T> collection)
  • Method Details

    • query

      public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor)
      Description copied from interface: IQueryable
      Performs a query, passing any objects that satisfy the query to the provided collector.

      This method is long-running; progress and cancellation are provided by the given progress monitor.

      Specified by:
      query in interface IQueryable<T>
      query - The query to perform
      monitor - a progress monitor, or null if progress reporting is not desired
      The collector argument
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: IQueryResult
      Returns whether this QueryResult is empty.
      Specified by:
      isEmpty in interface IQueryResult<T>
      true if this QueryResult has accepted any results, and false otherwise.
    • iterator

      public Iterator<T> iterator()
      Description copied from interface: IQueryResult
      Returns an iterator on the collected objects.
      Specified by:
      iterator in interface IQueryResult<T>
      Specified by:
      iterator in interface Iterable<T>
      an iterator of the collected objects.
    • toArray

      public T[] toArray(Class<T> clazz)
      Description copied from interface: IQueryResult
      Returns the collected objects as an array
      Specified by:
      toArray in interface IQueryResult<T>
      clazz - The type of array to return
      The array of results
    • toSet

      public Set<T> toSet()
      Description copied from interface: IQueryResult
      Creates a new Set copy with the contents of this query result. The copy can be altered without any side effects on its origin.
      Specified by:
      toSet in interface IQueryResult<T>
      A detached copy of the result.
    • toUnmodifiableSet

      public Set<T> toUnmodifiableSet()
      Description copied from interface: IQueryResult
      Returns a Set backed by this query result. The set is immutable.
      Specified by:
      toUnmodifiableSet in interface IQueryResult<T>
      A Set backed by this query result.
    • toString

      public String toString()
      toString in class Object