Package org.eclipse.equinox.p2.query
Class CollectionResult<T>
java.lang.Object
org.eclipse.equinox.p2.query.CollectionResult<T>
- All Implemented Interfaces:
Iterable<T>
,IQueryable<T>
,IQueryResult<T>
This class allows to adapt java collections to a p2 a query result and as
such something queryable
- Since:
- 2.0
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
isEmpty()
Returns whether this QueryResult is empty.iterator()
Returns an iterator on the collected objects.query
(IQuery<T> query, IProgressMonitor monitor) Performs a query, passing any objects that satisfy the query to the provided collector.stream()
Returns a sequentialStream
of the collected objects.T[]
Returns the collected objects as an arraytoSet()
Creates a new Set copy with the contents of this query result.toString()
Returns a Set backed by this query result.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.equinox.p2.query.IQueryable
contains
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CollectionResult
-
-
Method Details
-
query
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 interfaceIQueryable<T>
- Parameters:
query
- The query to performmonitor
- a progress monitor, ornull
if progress reporting is not desired- Returns:
- The collector argument
-
isEmpty
public boolean isEmpty()Description copied from interface:IQueryResult
Returns whether this QueryResult is empty.- Specified by:
isEmpty
in interfaceIQueryResult<T>
- Returns:
true
if this QueryResult has accepted any results, andfalse
otherwise.
-
iterator
Description copied from interface:IQueryResult
Returns an iterator on the collected objects. -
toArray
Description copied from interface:IQueryResult
Returns the collected objects as an array- Specified by:
toArray
in interfaceIQueryResult<T>
- Parameters:
clazz
- The type of array to return- Returns:
- The array of results
-
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 interfaceIQueryResult<T>
- Returns:
- A detached copy of the result.
-
toUnmodifiableSet
Description copied from interface:IQueryResult
Returns a Set backed by this query result. The set is immutable.- Specified by:
toUnmodifiableSet
in interfaceIQueryResult<T>
- Returns:
- A Set backed by this query result.
-
toString
-
stream
Description copied from interface:IQueryResult
Returns a sequentialStream
of the collected objects.- Specified by:
stream
in interfaceIQueryResult<T>
-