Package org.eclipse.equinox.p2.query
Class CollectionResult<T>
- java.lang.Object
-
- org.eclipse.equinox.p2.query.CollectionResult<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>,IQueryable<T>,IQueryResult<T>
public class CollectionResult<T> extends java.lang.Object implements 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
Constructors Constructor Description CollectionResult(java.util.Collection<T> collection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisEmpty()Returns whether this QueryResult is empty.java.util.Iterator<T>iterator()Returns an iterator on the collected objects.IQueryResult<T>query(IQuery<T> query, IProgressMonitor monitor)Performs a query, passing any objects that satisfy the query to the provided collector.T[]toArray(java.lang.Class<T> clazz)Returns the collected objects as an arrayjava.util.Set<T>toSet()Creates a new Set copy with the contents of this query result.java.lang.StringtoString()java.util.Set<T>toUnmodifiableSet()Returns a Set backed by this query result.
-
-
-
Constructor Detail
-
CollectionResult
public CollectionResult(java.util.Collection<T> collection)
-
-
Method Detail
-
query
public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor)
Description copied from interface:IQueryablePerforms 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:
queryin interfaceIQueryable<T>- Parameters:
query- The query to performmonitor- a progress monitor, ornullif progress reporting is not desired- Returns:
- The collector argument
-
isEmpty
public boolean isEmpty()
Description copied from interface:IQueryResultReturns whether this QueryResult is empty.- Specified by:
isEmptyin interfaceIQueryResult<T>- Returns:
trueif this QueryResult has accepted any results, andfalseotherwise.
-
iterator
public java.util.Iterator<T> iterator()
Description copied from interface:IQueryResultReturns an iterator on the collected objects.- Specified by:
iteratorin interfaceIQueryResult<T>- Specified by:
iteratorin interfacejava.lang.Iterable<T>- Returns:
- an iterator of the collected objects.
-
toArray
public T[] toArray(java.lang.Class<T> clazz)
Description copied from interface:IQueryResultReturns the collected objects as an array- Specified by:
toArrayin interfaceIQueryResult<T>- Parameters:
clazz- The type of array to return- Returns:
- The array of results
-
toSet
public java.util.Set<T> toSet()
Description copied from interface:IQueryResultCreates 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:
toSetin interfaceIQueryResult<T>- Returns:
- A detached copy of the result.
-
toUnmodifiableSet
public java.util.Set<T> toUnmodifiableSet()
Description copied from interface:IQueryResultReturns a Set backed by this query result. The set is immutable.- Specified by:
toUnmodifiableSetin interfaceIQueryResult<T>- Returns:
- A Set backed by this query result.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-