Package com.oracle.coherence.repository
Class AbstractRepository<ID,T>
- java.lang.Object
-
- com.oracle.coherence.repository.AbstractRepositoryBase<ID,T,NamedMap<ID,T>>
-
- com.oracle.coherence.repository.AbstractRepository<ID,T>
-
- Type Parameters:
ID- the type of entity's identifierT- the type of entity stored in this repository
public abstract class AbstractRepository<ID,T> extends AbstractRepositoryBase<ID,T,NamedMap<ID,T>>
Abstract base class for Coherence repository implementations.- Since:
- 21.06
- Author:
- Aleks Seovic 2021.01.28
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.oracle.coherence.repository.AbstractRepositoryBase
AbstractRepositoryBase.Listener<T>, AbstractRepositoryBase.MapListenerAdapter<ID,T>
-
-
Constructor Summary
Constructors Constructor Description AbstractRepository()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BigDecimalaverage(Filter<?> filter, Remote.ToBigDecimalFunction<? super T> extractor)Return the average of the specified function.doubleaverage(Filter<?> filter, Remote.ToDoubleFunction<? super T> extractor)Return the average of the specified function.doubleaverage(Filter<?> filter, Remote.ToIntFunction<? super T> extractor)Return the average of the specified function.doubleaverage(Filter<?> filter, Remote.ToLongFunction<? super T> extractor)Return the average of the specified function.BigDecimalaverage(Remote.ToBigDecimalFunction<? super T> extractor)Return the average of the specified function.doubleaverage(Remote.ToDoubleFunction<? super T> extractor)Return the average of the specified function.doubleaverage(Remote.ToIntFunction<? super T> extractor)Return the average of the specified function.doubleaverage(Remote.ToLongFunction<? super T> extractor)Return the average of the specified function.longcount()Return the number of entities in this repository.longcount(Filter<?> filter)Return the number of entities in this repository that satisfy specified filter.<R> Collection<? extends R>distinct(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor)Return the set of distinct values for the specified extractor.<R> Collection<? extends R>distinct(ValueExtractor<? super T,? extends R> extractor)Return the set of distinct values for the specified extractor.booleanexists(ID id)Returns true if this repository contains the entity with the specified identifier.Tget(ID id)Return an entity with a given identifier.<R> Rget(ID id, ValueExtractor<? super T,? extends R> extractor)Return the value extracted from an entity with a given identifier.Collection<T>getAll()Return all entities in this repository.Collection<T>getAll(Filter<?> filter)Return all entities that satisfy the specified criteria.<R> Map<ID,R>getAll(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor)Return a map of values extracted from a set of entities based on the specified criteria.<R> Map<ID,R>getAll(ValueExtractor<? super T,? extends R> extractor)Return a map of values extracted from all entities in the repository.Collection<T>getAll(Collection<? extends ID> colIds)Return the entities with the specified identifiers.<R> Map<ID,R>getAll(Collection<? extends ID> colIds, ValueExtractor<? super T,? extends R> extractor)Return a map of values extracted from a set of entities with the given identifiers.Collection<T>getAllOrderedBy(Filter<?> filter, Remote.Comparator<? super T> orderBy)Return all entities that satisfy the specified criteria, sorted using specifiedRemote.Comparator.<R extends Comparable<? super R>>
Collection<T>getAllOrderedBy(Filter<?> filter, ValueExtractor<? super T,? extends R> orderBy)Return all entities that satisfy the specified criteria, sorted using specifiedComparableattribute.Collection<T>getAllOrderedBy(Remote.Comparator<? super T> orderBy)Return all entities in this repository, sorted using specifiedRemote.Comparator.<R extends Comparable<? super R>>
Collection<T>getAllOrderedBy(ValueExtractor<? super T,? extends R> orderBy)Return all entities in this repository, sorted using specifiedComparableattribute.<K> Map<K,Set<T>>groupBy(Filter<?> filter, ValueExtractor<? super T,? extends K> extractor)Return the grouping of entities by the specified extractor.<K> Map<K,SortedSet<T>>groupBy(Filter<?> filter, ValueExtractor<? super T,? extends K> extractor, Remote.Comparator<? super T> orderBy)Return the grouping of entities by the specified extractor, ordered by the specified attribute within each group.<K,A,R,M extends Map<K,R>>
MgroupBy(Filter<?> filter, ValueExtractor<? super T,? extends K> extractor, Remote.Supplier<M> mapFactory, RemoteCollector<? super T,A,R> collector)Return the grouping of entities by the specified extractor.<K,A,R>
Map<K,R>groupBy(Filter<?> filter, ValueExtractor<? super T,? extends K> extractor, RemoteCollector<? super T,A,R> collector)Return the grouping of entities by the specified extractor.<K> Map<K,Set<T>>groupBy(ValueExtractor<? super T,? extends K> extractor)Return the grouping of entities by the specified extractor.<K> Map<K,SortedSet<T>>groupBy(ValueExtractor<? super T,? extends K> extractor, Remote.Comparator<? super T> orderBy)Return the grouping of entities by the specified extractor, ordered by the specified attribute within each group.<K,A,R,M extends Map<K,R>>
MgroupBy(ValueExtractor<? super T,? extends K> extractor, Remote.Supplier<M> mapFactory, RemoteCollector<? super T,A,R> collector)Return the grouping of entities by the specified extractor.<K,A,R>
Map<K,R>groupBy(ValueExtractor<? super T,? extends K> extractor, RemoteCollector<? super T,A,R> collector)Return the grouping of entities by the specified extractor.BigDecimalmax(Filter<?> filter, Remote.ToBigDecimalFunction<? super T> extractor)Return the maximum value of the specified function.<R extends Comparable<? super R>>
Rmax(Filter<?> filter, Remote.ToComparableFunction<? super T,R> extractor)Return the maximum value of the specified function.doublemax(Filter<?> filter, Remote.ToDoubleFunction<? super T> extractor)Return the maximum value of the specified function.intmax(Filter<?> filter, Remote.ToIntFunction<? super T> extractor)Return the maximum value of the specified function.longmax(Filter<?> filter, Remote.ToLongFunction<? super T> extractor)Return the maximum value of the specified function.BigDecimalmax(Remote.ToBigDecimalFunction<? super T> extractor)Return the maximum value of the specified function.<R extends Comparable<? super R>>
Rmax(Remote.ToComparableFunction<? super T,R> extractor)Return the maximum value of the specified function.doublemax(Remote.ToDoubleFunction<? super T> extractor)Return the maximum value of the specified function.intmax(Remote.ToIntFunction<? super T> extractor)Return the maximum value of the specified function.longmax(Remote.ToLongFunction<? super T> extractor)Return the maximum value of the specified function.<R extends Comparable<? super R>>
Optional<T>maxBy(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor)Return the entity with the maximum value of the specified function.<R extends Comparable<? super R>>
Optional<T>maxBy(ValueExtractor<? super T,? extends R> extractor)Return the entity with the maximum value of the specified function.BigDecimalmin(Filter<?> filter, Remote.ToBigDecimalFunction<? super T> extractor)Return the minimum value of the specified function.<R extends Comparable<? super R>>
Rmin(Filter<?> filter, Remote.ToComparableFunction<? super T,R> extractor)Return the minimum value of the specified function.doublemin(Filter<?> filter, Remote.ToDoubleFunction<? super T> extractor)Return the minimum value of the specified function.intmin(Filter<?> filter, Remote.ToIntFunction<? super T> extractor)Return the minimum value of the specified function.longmin(Filter<?> filter, Remote.ToLongFunction<? super T> extractor)Return the minimum value of the specified function.BigDecimalmin(Remote.ToBigDecimalFunction<? super T> extractor)Return the minimum value of the specified function.<R extends Comparable<? super R>>
Rmin(Remote.ToComparableFunction<? super T,R> extractor)Return the minimum value of the specified function.doublemin(Remote.ToDoubleFunction<? super T> extractor)Return the minimum value of the specified function.intmin(Remote.ToIntFunction<? super T> extractor)Return the minimum value of the specified function.longmin(Remote.ToLongFunction<? super T> extractor)Return the minimum value of the specified function.<R extends Comparable<? super R>>
Optional<T>minBy(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor)Return the entity with the minimum value of the specified function.<R extends Comparable<? super R>>
Optional<T>minBy(ValueExtractor<? super T,? extends R> extractor)Return the entity with the minimum value of the specified function.booleanremove(T entity)Remove the specified entity.Tremove(T entity, boolean fReturn)Remove specified entity.booleanremoveAll(Filter<?> filter)Remove all entities based on the specified criteria.Map<ID,T>removeAll(Filter<?> filter, boolean fReturn)Remove all entities based on the specified criteria.booleanremoveAll(Collection<? extends T> colEntities)Remove the specified entities.Map<ID,T>removeAll(Collection<? extends T> colEntities, boolean fReturn)Remove the specified entities.booleanremoveAll(Stream<? extends T> strEntities)Remove the specified entities.Map<ID,T>removeAll(Stream<? extends T> strEntities, boolean fReturn)Remove specified entities.booleanremoveAllById(Collection<? extends ID> colIds)Remove entities with the specified identifiers.Map<ID,T>removeAllById(Collection<? extends ID> colIds, boolean fReturn)Remove entities with the specified identifiers.booleanremoveById(ID id)Remove the entity with a specified identifier.TremoveById(ID id, boolean fReturn)Remove the entity with a specified identifier.Tsave(T entity)Store the specified entity.voidsaveAll(Collection<? extends T> colEntities)Store all specified entities as a batch.voidsaveAll(Stream<? extends T> strEntities)Store all specified entities as a batch.RemoteStream<T>stream()Return a stream of all entities in this repository.RemoteStream<T>stream(Filter<?> filter)Return a stream of all entities in this repository that satisfy the specified criteria.RemoteStream<T>stream(Collection<? extends ID> colIds)Return a stream of entities with the specified identifiers.BigDecimalsum(Filter<?> filter, Remote.ToBigDecimalFunction<? super T> extractor)Return the sum of the specified function.doublesum(Filter<?> filter, Remote.ToDoubleFunction<? super T> extractor)Return the sum of the specified function.longsum(Filter<?> filter, Remote.ToIntFunction<? super T> extractor)Return the sum of the specified function.longsum(Filter<?> filter, Remote.ToLongFunction<? super T> extractor)Return the sum of the specified function.BigDecimalsum(Remote.ToBigDecimalFunction<? super T> extractor)Return the sum of the specified function.doublesum(Remote.ToDoubleFunction<? super T> extractor)Return the sum of the specified function.longsum(Remote.ToIntFunction<? super T> extractor)Return the sum of the specified function.longsum(Remote.ToLongFunction<? super T> extractor)Return the sum of the specified function.<R extends Comparable<? super R>>
List<R>top(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor, int cResults)Return the top N highest values for the specified extractor.<R> List<R>top(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor, Remote.Comparator<? super R> comparator, int cResults)Return the top N highest values for the specified extractor.<R extends Comparable<? super R>>
List<R>top(ValueExtractor<? super T,? extends R> extractor, int cResults)Return the top N highest values for the specified extractor.<R> List<R>top(ValueExtractor<? super T,? extends R> extractor, Remote.Comparator<? super R> comparator, int cResults)Return the top N highest values for the specified extractor.List<T>topBy(Filter<?> filter, Remote.Comparator<? super T> comparator, int cResults)Return the top N entities with the highest values for the specified extractor.<R extends Comparable<? super R>>
List<T>topBy(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor, int cResults)Return the top N entities with the highest values for the specified extractor.List<T>topBy(Remote.Comparator<? super T> comparator, int cResults)Return the top N entities with the highest values for the specified extractor.<R extends Comparable<? super R>>
List<T>topBy(ValueExtractor<? super T,? extends R> extractor, int cResults)Return the top N entities with the highest values for the specified extractor.<U,R>
Rupdate(ID id, Remote.BiFunction<? super T,? super U,? extends R> updater, U value)Update an entity using specified updater and the new value.<U,R>
Rupdate(ID id, Remote.BiFunction<? super T,? super U,? extends R> updater, U value, EntityFactory<? super ID,? extends T> factory)Update an entity using specified updater function, and optionalEntityFactorythat will be used to create entity instance if it doesn't already exist in the repository.<R> Rupdate(ID id, Remote.Function<? super T,? extends R> updater)Update an entity using specified updater function.<R> Rupdate(ID id, Remote.Function<? super T,? extends R> updater, EntityFactory<? super ID,? extends T> factory)Update an entity using specified updater function, and optionalEntityFactorythat will be used to create entity instance if it doesn't already exist in the repository.<U> voidupdate(ID id, ValueUpdater<? super T,? super U> updater, U value)Update an entity using specified updater and the new value.<U> voidupdate(ID id, ValueUpdater<? super T,? super U> updater, U value, EntityFactory<? super ID,? extends T> factory)Update an entity using specified updater and the new value, and optionalEntityFactorythat will be used to create entity instance if it doesn't already exist in the repository.<U,R>
Map<ID,R>updateAll(Filter<?> filter, Remote.BiFunction<? super T,? super U,? extends R> updater, U value)Update multiple entities using specified updater and the new value.<R> Map<ID,R>updateAll(Filter<?> filter, Remote.Function<? super T,? extends R> updater)Update multiple entities using specified updater function.<U> voidupdateAll(Filter<?> filter, ValueUpdater<? super T,? super U> updater, U value)Update multiple entities using specified updater and the new value.-
Methods inherited from class com.oracle.coherence.repository.AbstractRepositoryBase
addListener, addListener, addListener, createIndices, ensureInitialized, getEntityType, getId, getMap, instantiateMapListener, listener, removeListener, removeListener, removeListener
-
-
-
-
Method Detail
-
save
public T save(T entity)
Store the specified entity.- Parameters:
entity- the entity to store- Returns:
- the saved entity
-
saveAll
public void saveAll(Collection<? extends T> colEntities)
Store all specified entities as a batch.- Parameters:
colEntities- the entities to store
-
saveAll
public void saveAll(Stream<? extends T> strEntities)
Store all specified entities as a batch.- Parameters:
strEntities- the entities to store
-
get
public T get(ID id)
Return an entity with a given identifier.- Parameters:
id- the entity's identifier- Returns:
- an entity with a given identifier
-
exists
public boolean exists(ID id)
Returns true if this repository contains the entity with the specified identifier.- Parameters:
id- the identifier of an entity to check if it exists- Returns:
trueif this repository contains the entity with the specified identifier
-
get
public <R> R get(ID id, ValueExtractor<? super T,? extends R> extractor)
Return the value extracted from an entity with a given identifier. For example, you could extractPerson'snameattribute by calling a getter on a remotePersonentity instance:people.get(ssn, Person::getName);You could also extract aFragmentcontaining thePerson'snameandageattributes by calling corresponding getters on the remotePersonentity instance:Fragment<Person> person = people.get(ssn, Extractors.fragment(Person::getName, Person::getAge)); System.out.println("name: " + person.get(Person::getName)); System.out.println(" age: " + person.get(Person::getAge));Finally, you can also extract nested fragments:Fragment<Person> person = people.get(ssn, Extractors.fragment(Person::getName, Person::getAge, Extractors.fragment(Person::getAddress, Address::getCity, Address::getState)); System.out.println(" name: " + person.get(Person::getName)); System.out.println(" age: " + person.get(Person::getAge)); Fragment<Address> address = person.getFragment(Person::getAddress); System.out.println(" city: " + address.get(Address::getCity)); System.out.println("state: " + address.get(Address::getState));Note that the actual extraction (via the invocation of the specified getter method) will happen on the primary owner for the specified entity, and only the extracted value will be sent over the network to the client, which can significantly reduce the amount of data transferred.- Type Parameters:
R- the type of the extracted value- Parameters:
id- the entity's identifierextractor- theValueExtractorto extract value with- Returns:
- the extracted value
-
getAll
public Collection<T> getAll()
Return all entities in this repository.- Returns:
- all entities in this repository
-
getAll
public <R> Map<ID,R> getAll(ValueExtractor<? super T,? extends R> extractor)
Return a map of values extracted from all entities in the repository.- Type Parameters:
R- the type of the extracted values- Parameters:
extractor- theValueExtractorto extract values with- Returns:
- the map of extracted values, keyed by entity id
- See Also:
get(Object, ValueExtractor)
-
getAll
public Collection<T> getAll(Collection<? extends ID> colIds)
Return the entities with the specified identifiers.- Parameters:
colIds- the entity identifiers- Returns:
- the entities with the specified identifiers
-
getAll
public <R> Map<ID,R> getAll(Collection<? extends ID> colIds, ValueExtractor<? super T,? extends R> extractor)
Return a map of values extracted from a set of entities with the given identifiers.- Type Parameters:
R- the type of the extracted values- Parameters:
colIds- the entity identifiersextractor- theValueExtractorto extract values with- Returns:
- the map of extracted values, keyed by entity id
- See Also:
get(Object, ValueExtractor)
-
getAll
public Collection<T> getAll(Filter<?> filter)
Return all entities that satisfy the specified criteria.- Parameters:
filter- the criteria to evaluate- Returns:
- all entities that satisfy the specified criteria
-
getAll
public <R> Map<ID,R> getAll(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor)
Return a map of values extracted from a set of entities based on the specified criteria.- Type Parameters:
R- the type of the extracted values- Parameters:
filter- the criteria to use to select entities for extractionextractor- theValueExtractorto extract values with- Returns:
- the map of extracted values, keyed by entity id
- See Also:
get(Object, ValueExtractor)
-
getAllOrderedBy
public <R extends Comparable<? super R>> Collection<T> getAllOrderedBy(ValueExtractor<? super T,? extends R> orderBy)
Return all entities in this repository, sorted using specifiedComparableattribute.- Type Parameters:
R- the type of the extracted values- Parameters:
orderBy- theComparableattribute to sort the results by- Returns:
- all entities in this repository, sorted using
specified
Comparableattribute.
-
getAllOrderedBy
public <R extends Comparable<? super R>> Collection<T> getAllOrderedBy(Filter<?> filter, ValueExtractor<? super T,? extends R> orderBy)
Return all entities that satisfy the specified criteria, sorted using specifiedComparableattribute.- Type Parameters:
R- the type of the extracted values- Parameters:
filter- the criteria to evaluateorderBy- theComparableattribute to sort the results by- Returns:
- all entities that satisfy specified criteria, sorted using
specified
Comparableattribute.
-
getAllOrderedBy
public Collection<T> getAllOrderedBy(Remote.Comparator<? super T> orderBy)
Return all entities in this repository, sorted using specifiedRemote.Comparator.- Parameters:
orderBy- the comparator to sort the results with- Returns:
- all entities in this repository, sorted using
specified
Remote.Comparator.
-
getAllOrderedBy
public Collection<T> getAllOrderedBy(Filter<?> filter, Remote.Comparator<? super T> orderBy)
Return all entities that satisfy the specified criteria, sorted using specifiedRemote.Comparator.- Parameters:
filter- the criteria to evaluateorderBy- the comparator to sort the results with- Returns:
- all entities that satisfy specified criteria, sorted using
specified
Remote.Comparator.
-
update
public <U> void update(ID id, ValueUpdater<? super T,? super U> updater, U value)
Update an entity using specified updater and the new value. For example, you could updatePerson'sageattribute by calling a setter on a remotePersonentity instance:people.update(ssn, Person::setAge, 21);Note that the actual update (via the invocation of the specified setter method) will happen on the primary owner for the specified entity, and the updater will have exclusive access to an entity during the execution.- Type Parameters:
U- the type of value to update- Parameters:
id- the entity's identifierupdater- the updater function to usevalue- the value to update entity with, which will be passed as an argument to the updater function
-
update
public <U> void update(ID id, ValueUpdater<? super T,? super U> updater, U value, EntityFactory<? super ID,? extends T> factory)
Update an entity using specified updater and the new value, and optionalEntityFactorythat will be used to create entity instance if it doesn't already exist in the repository. For example, you could updatePerson'sageattribute by calling a setter on a remotePersonentity instance:people.update(ssn, Person::setAge, 21, Person::new);If the person with the specified identifier does not exist, theEntityFactorywill be used to create a new instance. In the example above, it will invoke a constructor on thePersonclass that takes identifier as an argument. Note that the actual update (via the invocation of the specified setter method) will happen on the primary owner for the specified entity, and the updater will have exclusive access to an entity during the execution.- Type Parameters:
U- the type of value to update- Parameters:
id- the entity's identifierupdater- the updater function to usevalue- the value to update entity with, which will be passed as an argument to the updater functionfactory- the entity factory to use to create new entity instance
-
update
public <R> R update(ID id, Remote.Function<? super T,? extends R> updater)
Update an entity using specified updater function. For example, you could incrementPerson'sageattribute and return the updatedPersonentity:people.update(ssn, person -> { person.setAge(person.getAge() + 1); return person; });This variant of theupdatemethod offers ultimate flexibility, as it allows you to return any value you want as the result of the invocation, at the cost of typically slightly more complex logic at the call site. Note that the actual update (via the evaluation of the specified function) will happen on the primary owner for the specified entity, and the updater will have exclusive access to an entity during the execution.- Type Parameters:
R- the type of return value of the updater function- Parameters:
id- the entity's identifierupdater- the updater function to use- Returns:
- the result of updater function evaluation
-
update
public <R> R update(ID id, Remote.Function<? super T,? extends R> updater, EntityFactory<? super ID,? extends T> factory)
Update an entity using specified updater function, and optionalEntityFactorythat will be used to create entity instance if it doesn't already exist in the repository. For example, you could incrementPerson'sageattribute and return the updatedPersonentity:people.update(ssn, person -> { person.setAge(person.getAge() + 1); return person; }, Person::new);If the person with the specified identifier does not exist, theEntityFactorywill be used to create a new instance. In the example above, it will invoke a constructor on thePersonclass that takes identifier as an argument. This variant of theupdatemethod offers ultimate flexibility, as it allows you to return any value you want as the result of the invocation, at the cost of typically slightly more complex logic at the call site. Note that the actual update (via the evaluation of the specified function) will happen on the primary owner for the specified entity, and the updater will have exclusive access to an entity during the execution.- Type Parameters:
R- the type of return value of the updater function- Parameters:
id- the entity's identifierupdater- the updater function to usefactory- the entity factory to use to create new entity instance- Returns:
- the result of updater function evaluation
-
update
public <U,R> R update(ID id, Remote.BiFunction<? super T,? super U,? extends R> updater, U value)
Update an entity using specified updater and the new value. Unlikeupdate(Object, ValueUpdater, Object), which doesn't return anything, this method is typically used to invoke "fluent" methods on the target entity that return entity itself (although they are free to return any value they want). For example, you could use it to add an item to theShoppingCartentity and return the updatedShoppingCartinstance in a single call:Item item = ... ShoppingCart cart = carts.update(cartId, ShoppingCart::addItem, item);Note that the actual update (via the invocation of the specified setter method) will happen on the primary owner for the specified entity, and the updater will have exclusive access to an entity during the execution.- Type Parameters:
U- the type of value to updateR- the type of return value of the updater function- Parameters:
id- the entity's identifierupdater- the updater function to usevalue- the value to update entity with, which will be passed as an argument to the updater function- Returns:
- the result of updater function evaluation
-
update
public <U,R> R update(ID id, Remote.BiFunction<? super T,? super U,? extends R> updater, U value, EntityFactory<? super ID,? extends T> factory)
Update an entity using specified updater function, and optionalEntityFactorythat will be used to create entity instance if it doesn't already exist in the repository. Unlikeupdate(Object, ValueUpdater, Object), which doesn't return anything, this method is typically used to invoke "fluent" methods on the target entity that return entity itself (although they are free to return any value they want). For example, you could use it to add an item to theShoppingCartentity and return the updatedShoppingCartinstance in a single call:Item item = ... ShoppingCart cart = carts.update(cartId, ShoppingCart::addItem, item, ShoppingCart::new);If the cart with the specified identifier does not exist, the specifiedEntityFactorywill be used to create a new instance. In the example above, it will invoke a constructor on theShoppingCartclass that takes identifier as an argument. Note that the actual update (via the evaluation of the specified function) will happen on the primary owner for the specified entity, and the updater will have exclusive access to an entity during the execution.- Type Parameters:
U- the type of value to updateR- the type of return value of the updater function- Parameters:
id- the entity's identifierupdater- the updater function to usevalue- the value to update entity with, which will be passed as an argument to the updater functionfactory- the entity factory to use to create new entity instance- Returns:
- the result of updater function evaluation
-
updateAll
public <U> void updateAll(Filter<?> filter, ValueUpdater<? super T,? super U> updater, U value)
Update multiple entities using specified updater and the new value.- Type Parameters:
U- the type of value to update- Parameters:
filter- the criteria to use to select entities to updateupdater- the updater function to usevalue- the value to update each entity with, which will be passed as an argument to the updater function
-
updateAll
public <R> Map<ID,R> updateAll(Filter<?> filter, Remote.Function<? super T,? extends R> updater)
Update multiple entities using specified updater function.- Type Parameters:
R- the type of return value of the updater function- Parameters:
filter- the criteria to use to select entities to updateupdater- the updater function to use- Returns:
- a map of updater function results, keyed by entity id
-
updateAll
public <U,R> Map<ID,R> updateAll(Filter<?> filter, Remote.BiFunction<? super T,? super U,? extends R> updater, U value)
Update multiple entities using specified updater and the new value.- Type Parameters:
U- the type of value to updateR- the type of return value of the updater function- Parameters:
filter- the criteria to use to select entities to updateupdater- the updater function to usevalue- the value to update each entity with, which will be passed as an argument to the updater function- Returns:
- a map of updater function results, keyed by entity id
-
removeById
public boolean removeById(ID id)
Remove the entity with a specified identifier.- Parameters:
id- the identifier of an entity to remove, if present- Returns:
trueif this repository contained the specified entity
-
removeById
public T removeById(ID id, boolean fReturn)
Remove the entity with a specified identifier.- Parameters:
id- the identifier of an entity to removefReturn- the flag specifying whether to return removed entity- Returns:
- removed entity, iff
fReturn == true;nullotherwise
-
remove
public boolean remove(T entity)
Remove the specified entity.- Parameters:
entity- the entity to remove- Returns:
trueif this repository contained the specified entity
-
remove
public T remove(T entity, boolean fReturn)
Remove specified entity.- Parameters:
entity- the entity to removefReturn- the flag specifying whether to return removed entity- Returns:
- removed entity, iff
fReturn == true;nullotherwise
-
removeAllById
public boolean removeAllById(Collection<? extends ID> colIds)
Remove entities with the specified identifiers.- Parameters:
colIds- the identifiers of the entities to remove- Returns:
trueif this repository changed as a result of the call
-
removeAllById
public Map<ID,T> removeAllById(Collection<? extends ID> colIds, boolean fReturn)
Remove entities with the specified identifiers.- Parameters:
colIds- the identifiers of the entities to removefReturn- the flag specifying whether to return removed entity- Returns:
- the map of removed entity identifiers as keys, and the removed
entities as values iff
fReturn == true;nullotherwise
-
removeAll
public boolean removeAll(Collection<? extends T> colEntities)
Remove the specified entities.- Parameters:
colEntities- the entities to remove- Returns:
trueif this repository changed as a result of the call
-
removeAll
public Map<ID,T> removeAll(Collection<? extends T> colEntities, boolean fReturn)
Remove the specified entities.- Parameters:
colEntities- the entities to removefReturn- the flag specifying whether to return removed entity- Returns:
- the map of removed entity identifiers as keys, and the removed
entities as values iff
fReturn == true;nullotherwise
-
removeAll
public boolean removeAll(Stream<? extends T> strEntities)
Remove the specified entities.- Parameters:
strEntities- the entities to remove- Returns:
trueif this repository changed as a result of the call
-
removeAll
public Map<ID,T> removeAll(Stream<? extends T> strEntities, boolean fReturn)
Remove specified entities.- Parameters:
strEntities- the entities to removefReturn- the flag specifying whether to return removed entity- Returns:
- the map of removed entity identifiers as keys, and the removed
entities as values iff
fReturn == true;nullotherwise
-
removeAll
public boolean removeAll(Filter<?> filter)
Remove all entities based on the specified criteria.- Parameters:
filter- the criteria that should be used to select entities to remove- Returns:
trueif this repository changed as a result of the call
-
removeAll
public Map<ID,T> removeAll(Filter<?> filter, boolean fReturn)
Remove all entities based on the specified criteria.- Parameters:
filter- the criteria that should be used to select entities to removefReturn- the flag specifying whether to return removed entity- Returns:
- the map of removed entity identifiers as keys, and the removed
entities as values iff
fReturn == true;nullotherwise
-
stream
public RemoteStream<T> stream()
Return a stream of all entities in this repository.- Returns:
- a stream of all entities in this repository
-
stream
public RemoteStream<T> stream(Collection<? extends ID> colIds)
Return a stream of entities with the specified identifiers.- Parameters:
colIds- the identifiers of the entities to include in the returned stream- Returns:
- a stream of entities for the specified identifiers
-
stream
public RemoteStream<T> stream(Filter<?> filter)
Return a stream of all entities in this repository that satisfy the specified criteria.- Parameters:
filter- the criteria an entity must satisfy in order to be included in the returned stream- Returns:
- a stream of entities that satisfy the specified criteria
-
count
public long count()
Return the number of entities in this repository.- Returns:
- the number of entities in this repository
-
count
public long count(Filter<?> filter)
Return the number of entities in this repository that satisfy specified filter.- Parameters:
filter- the filter to evaluate- Returns:
- the number of entities in this repository that satisfy specified filter
-
max
public int max(Remote.ToIntFunction<? super T> extractor)
Return the maximum value of the specified function.- Parameters:
extractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the maximum value of the specified function
-
max
public int max(Filter<?> filter, Remote.ToIntFunction<? super T> extractor)
Return the maximum value of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the maximum value of the specified function
-
max
public long max(Remote.ToLongFunction<? super T> extractor)
Return the maximum value of the specified function.- Parameters:
extractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the maximum value of the specified function
-
max
public long max(Filter<?> filter, Remote.ToLongFunction<? super T> extractor)
Return the maximum value of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the maximum value of the specified function
-
max
public double max(Remote.ToDoubleFunction<? super T> extractor)
Return the maximum value of the specified function.- Parameters:
extractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getWeight- Returns:
- the maximum value of the specified function
-
max
public double max(Filter<?> filter, Remote.ToDoubleFunction<? super T> extractor)
Return the maximum value of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getWeight- Returns:
- the maximum value of the specified function
-
max
public BigDecimal max(Remote.ToBigDecimalFunction<? super T> extractor)
Return the maximum value of the specified function.- Parameters:
extractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getSalary- Returns:
- the maximum value of the specified function
-
max
public BigDecimal max(Filter<?> filter, Remote.ToBigDecimalFunction<? super T> extractor)
Return the maximum value of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getSalary- Returns:
- the maximum value of the specified function
-
max
public <R extends Comparable<? super R>> R max(Remote.ToComparableFunction<? super T,R> extractor)
Return the maximum value of the specified function.- Type Parameters:
R- the type of the extracted value- Parameters:
extractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getName- Returns:
- the maximum value of the specified function
-
max
public <R extends Comparable<? super R>> R max(Filter<?> filter, Remote.ToComparableFunction<? super T,R> extractor)
Return the maximum value of the specified function.- Type Parameters:
R- the type of the extracted value- Parameters:
filter- the entity selection criteriaextractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getName- Returns:
- the maximum value of the specified function
-
maxBy
public <R extends Comparable<? super R>> Optional<T> maxBy(ValueExtractor<? super T,? extends R> extractor)
Return the entity with the maximum value of the specified function.- Type Parameters:
R- the type of the extracted value- Parameters:
extractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the entity with the maximum value of the specified function
-
maxBy
public <R extends Comparable<? super R>> Optional<T> maxBy(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor)
Return the entity with the maximum value of the specified function.- Type Parameters:
R- the type of the extracted value- Parameters:
filter- the entity selection criteriaextractor- the function to determine the maximum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the entity with the maximum value of the specified function
-
min
public int min(Remote.ToIntFunction<? super T> extractor)
Return the minimum value of the specified function.- Parameters:
extractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the minimum value of the specified function
-
min
public int min(Filter<?> filter, Remote.ToIntFunction<? super T> extractor)
Return the minimum value of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the minimum value of the specified function
-
min
public long min(Remote.ToLongFunction<? super T> extractor)
Return the minimum value of the specified function.- Parameters:
extractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the minimum value of the specified function
-
min
public long min(Filter<?> filter, Remote.ToLongFunction<? super T> extractor)
Return the minimum value of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the minimum value of the specified function
-
min
public double min(Remote.ToDoubleFunction<? super T> extractor)
Return the minimum value of the specified function.- Parameters:
extractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getWeight- Returns:
- the minimum value of the specified function
-
min
public double min(Filter<?> filter, Remote.ToDoubleFunction<? super T> extractor)
Return the minimum value of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getWeight- Returns:
- the minimum value of the specified function
-
min
public BigDecimal min(Remote.ToBigDecimalFunction<? super T> extractor)
Return the minimum value of the specified function.- Parameters:
extractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getSalary- Returns:
- the minimum value of the specified function
-
min
public BigDecimal min(Filter<?> filter, Remote.ToBigDecimalFunction<? super T> extractor)
Return the minimum value of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getSalary- Returns:
- the minimum value of the specified function
-
min
public <R extends Comparable<? super R>> R min(Remote.ToComparableFunction<? super T,R> extractor)
Return the minimum value of the specified function.- Type Parameters:
R- the type of the extracted value- Parameters:
extractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getName- Returns:
- the minimum value of the specified function
-
min
public <R extends Comparable<? super R>> R min(Filter<?> filter, Remote.ToComparableFunction<? super T,R> extractor)
Return the minimum value of the specified function.- Type Parameters:
R- the type of the extracted value- Parameters:
filter- the entity selection criteriaextractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getName- Returns:
- the minimum value of the specified function
-
minBy
public <R extends Comparable<? super R>> Optional<T> minBy(ValueExtractor<? super T,? extends R> extractor)
Return the entity with the minimum value of the specified function.- Type Parameters:
R- the type of the extracted value- Parameters:
extractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the entity with the minimum value of the specified function
-
minBy
public <R extends Comparable<? super R>> Optional<T> minBy(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor)
Return the entity with the minimum value of the specified function.- Type Parameters:
R- the type of the extracted value- Parameters:
filter- the entity selection criteriaextractor- the function to determine the minimum value for; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the entity with the minimum value of the specified function
-
sum
public long sum(Remote.ToIntFunction<? super T> extractor)
Return the sum of the specified function.- Parameters:
extractor- the function to sum; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the sum of the specified function
-
sum
public long sum(Filter<?> filter, Remote.ToIntFunction<? super T> extractor)
Return the sum of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to sum; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the sum of the specified function
-
sum
public long sum(Remote.ToLongFunction<? super T> extractor)
Return the sum of the specified function.- Parameters:
extractor- the function to sum; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the sum of the specified function
-
sum
public long sum(Filter<?> filter, Remote.ToLongFunction<? super T> extractor)
Return the sum of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to sum; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the sum of the specified function
-
sum
public double sum(Remote.ToDoubleFunction<? super T> extractor)
Return the sum of the specified function.- Parameters:
extractor- the function to sum; typically a method reference on the entity class, such asPerson::getWeight- Returns:
- the sum of the specified function
-
sum
public double sum(Filter<?> filter, Remote.ToDoubleFunction<? super T> extractor)
Return the sum of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to sum; typically a method reference on the entity class, such asPerson::getWeight- Returns:
- the sum of the specified function
-
sum
public BigDecimal sum(Remote.ToBigDecimalFunction<? super T> extractor)
Return the sum of the specified function.- Parameters:
extractor- the function to sum; typically a method reference on the entity class, such asPerson::getSalary- Returns:
- the sum of the specified function
-
sum
public BigDecimal sum(Filter<?> filter, Remote.ToBigDecimalFunction<? super T> extractor)
Return the sum of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to sum; typically a method reference on the entity class, such asPerson::getSalary- Returns:
- the sum of the specified function
-
average
public double average(Remote.ToIntFunction<? super T> extractor)
Return the average of the specified function.- Parameters:
extractor- the function to average; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the average of the specified function
-
average
public double average(Filter<?> filter, Remote.ToIntFunction<? super T> extractor)
Return the average of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to average; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the average of the specified function
-
average
public double average(Remote.ToLongFunction<? super T> extractor)
Return the average of the specified function.- Parameters:
extractor- the function to average; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the average of the specified function
-
average
public double average(Filter<?> filter, Remote.ToLongFunction<? super T> extractor)
Return the average of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to average; typically a method reference on the entity class, such asPerson::getAge- Returns:
- the average of the specified function
-
average
public double average(Remote.ToDoubleFunction<? super T> extractor)
Return the average of the specified function.- Parameters:
extractor- the function to average; typically a method reference on the entity class, such asPerson::getWeight- Returns:
- the average of the specified function
-
average
public double average(Filter<?> filter, Remote.ToDoubleFunction<? super T> extractor)
Return the average of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to average; typically a method reference on the entity class, such asPerson::getWeight- Returns:
- the average of the specified function
-
average
public BigDecimal average(Remote.ToBigDecimalFunction<? super T> extractor)
Return the average of the specified function.- Parameters:
extractor- the function to average; typically a method reference on the entity class, such asPerson::getSalary- Returns:
- the average of the specified function
-
average
public BigDecimal average(Filter<?> filter, Remote.ToBigDecimalFunction<? super T> extractor)
Return the average of the specified function.- Parameters:
filter- the entity selection criteriaextractor- the function to average; typically a method reference on the entity class, such asPerson::getSalary- Returns:
- the average of the specified function
-
distinct
public <R> Collection<? extends R> distinct(ValueExtractor<? super T,? extends R> extractor)
Return the set of distinct values for the specified extractor.- Type Parameters:
R- the type of extracted values- Parameters:
extractor- the extractor to get a value from; typically a method reference on the entity class, such asPerson::getName- Returns:
- the set of distinct values for the specified extractor
-
distinct
public <R> Collection<? extends R> distinct(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor)
Return the set of distinct values for the specified extractor.- Type Parameters:
R- the type of extracted values- Parameters:
filter- the entity selection criteriaextractor- the extractor to get a value from; typically a method reference on the entity class, such asPerson::getName- Returns:
- the set of distinct values for the specified extractor
-
groupBy
public <K> Map<K,Set<T>> groupBy(ValueExtractor<? super T,? extends K> extractor)
Return the grouping of entities by the specified extractor.- Type Parameters:
K- the type of extracted grouping keys- Parameters:
extractor- the extractor to get a grouping value from; typically a method reference on the entity class, such asPerson::getGender- Returns:
- the the grouping of entities by the specified extractor; the keys
in the returned map will be distinct values extracted by the
specified
extractor, and the values will be sets of entities that match each extracted key
-
groupBy
public <K> Map<K,SortedSet<T>> groupBy(ValueExtractor<? super T,? extends K> extractor, Remote.Comparator<? super T> orderBy)
Return the grouping of entities by the specified extractor, ordered by the specified attribute within each group.- Type Parameters:
K- the type of extracted grouping keys- Parameters:
extractor- the extractor to get a grouping value from; typically a method reference on the entity class, such asPerson::getGenderorderBy- theRemote.Comparatorto sort the results within each group by- Returns:
- the the grouping of entities by the specified extractor; the keys
in the returned map will be distinct values extracted by the
specified
extractor, and the values will be sorted sets of entities that match each extracted key
-
groupBy
public <K> Map<K,Set<T>> groupBy(Filter<?> filter, ValueExtractor<? super T,? extends K> extractor)
Return the grouping of entities by the specified extractor.- Type Parameters:
K- the type of extracted grouping keys- Parameters:
filter- the entity selection criteriaextractor- the extractor to get a grouping value from; typically a method reference on the entity class, such asPerson::getGender- Returns:
- the the grouping of entities by the specified extractor; the keys
in the returned map will be distinct values extracted by the
specified
extractor, and the values will be sets of entities that match each extracted key
-
groupBy
public <K> Map<K,SortedSet<T>> groupBy(Filter<?> filter, ValueExtractor<? super T,? extends K> extractor, Remote.Comparator<? super T> orderBy)
Return the grouping of entities by the specified extractor, ordered by the specified attribute within each group.- Type Parameters:
K- the type of extracted grouping keys- Parameters:
filter- the entity selection criteriaextractor- the extractor to get a grouping value from; typically a method reference on the entity class, such asPerson::getGenderorderBy- theRemote.Comparatorto sort the results within each group by- Returns:
- the the grouping of entities by the specified extractor; the keys
in the returned map will be distinct values extracted by the
specified
extractor, and the values will be sorted sets of entities that match each extracted key
-
groupBy
public <K,A,R> Map<K,R> groupBy(ValueExtractor<? super T,? extends K> extractor, RemoteCollector<? super T,A,R> collector)
Return the grouping of entities by the specified extractor.- Type Parameters:
K- the type of extracted grouping keysA- the type of collector's accumulatorR- the type of collector's result- Parameters:
extractor- the extractor to get a grouping value from; typically a method reference on the entity class, such asPerson::getGendercollector- theRemoteCollectorto apply to grouped entities- Returns:
- the the grouping of entities by the specified extractor; the keys
in the returned map will be distinct values extracted by the
specified
extractor, and the values will be results of the specifiedcollectorfor each group - See Also:
RemoteCollectors
-
groupBy
public <K,A,R> Map<K,R> groupBy(Filter<?> filter, ValueExtractor<? super T,? extends K> extractor, RemoteCollector<? super T,A,R> collector)
Return the grouping of entities by the specified extractor.- Type Parameters:
K- the type of extracted grouping keysA- the type of collector's accumulatorR- the type of collector's result- Parameters:
filter- the entity selection criteriaextractor- the extractor to get a grouping value from; typically a method reference on the entity class, such asPerson::getGendercollector- theRemoteCollectorto apply to grouped entities- Returns:
- the the grouping of entities by the specified extractor; the keys
in the returned map will be distinct values extracted by the
specified
extractor, and the values will be results of the specifiedcollectorfor each group - See Also:
RemoteCollectors
-
groupBy
public <K,A,R,M extends Map<K,R>> M groupBy(ValueExtractor<? super T,? extends K> extractor, Remote.Supplier<M> mapFactory, RemoteCollector<? super T,A,R> collector)
Return the grouping of entities by the specified extractor.- Type Parameters:
K- the type of extracted grouping keysA- the type of collector's accumulatorR- the type of collector's resultM- the type of resultMap- Parameters:
extractor- the extractor to get a grouping value from; typically a method reference on the entity class, such asPerson::getGendermapFactory- the supplier to use to create resultMapcollector- theRemoteCollectorto apply to grouped entities- Returns:
- the the grouping of entities by the specified extractor; the keys
in the returned map will be distinct values extracted by the
specified
extractor, and the values will be results of the specifiedcollectorfor each group - See Also:
RemoteCollectors
-
groupBy
public <K,A,R,M extends Map<K,R>> M groupBy(Filter<?> filter, ValueExtractor<? super T,? extends K> extractor, Remote.Supplier<M> mapFactory, RemoteCollector<? super T,A,R> collector)
Return the grouping of entities by the specified extractor.- Type Parameters:
K- the type of extracted grouping keysA- the type of collector's accumulatorR- the type of collector's resultM- the type of resultMap- Parameters:
filter- the entity selection criteriaextractor- the extractor to get a grouping value from; typically a method reference on the entity class, such asPerson::getGendermapFactory- the supplier to use to create resultMapcollector- theRemoteCollectorto apply to grouped entities- Returns:
- the the grouping of entities by the specified extractor; the keys
in the returned map will be distinct values extracted by the
specified
extractor, and the values will be results of the specifiedcollectorfor each group - See Also:
RemoteCollectors
-
top
public <R extends Comparable<? super R>> List<R> top(ValueExtractor<? super T,? extends R> extractor, int cResults)
Return the top N highest values for the specified extractor.- Type Parameters:
R- the type of returned values- Parameters:
extractor- the extractor to get the values to compare withcResults- the number of highest values to return- Returns:
- the top N highest values for the specified extractor
-
top
public <R extends Comparable<? super R>> List<R> top(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor, int cResults)
Return the top N highest values for the specified extractor.- Type Parameters:
R- the type of returned values- Parameters:
filter- the entity selection criteriaextractor- the extractor to get the values to compare withcResults- the number of highest values to return- Returns:
- the top N highest values for the specified extractor
-
top
public <R> List<R> top(ValueExtractor<? super T,? extends R> extractor, Remote.Comparator<? super R> comparator, int cResults)
Return the top N highest values for the specified extractor.- Type Parameters:
R- the type of returned values- Parameters:
extractor- the extractor to get the values to compare withcomparator- the comparator to use when comparing extracted valuescResults- the number of highest values to return- Returns:
- the top N highest values for the specified extractor
-
top
public <R> List<R> top(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor, Remote.Comparator<? super R> comparator, int cResults)
Return the top N highest values for the specified extractor.- Type Parameters:
R- the type of returned values- Parameters:
filter- the entity selection criteriaextractor- the extractor to get the values to compare withcomparator- the comparator to use when comparing extracted valuescResults- the number of highest values to return- Returns:
- the top N highest values for the specified extractor
-
topBy
public <R extends Comparable<? super R>> List<T> topBy(ValueExtractor<? super T,? extends R> extractor, int cResults)
Return the top N entities with the highest values for the specified extractor.- Type Parameters:
R- the type of values used for comparison- Parameters:
extractor- the extractor to get the values to compare withcResults- the number of highest values to return- Returns:
- the top N entities with the highest values for the specified extractor
-
topBy
public <R extends Comparable<? super R>> List<T> topBy(Filter<?> filter, ValueExtractor<? super T,? extends R> extractor, int cResults)
Return the top N entities with the highest values for the specified extractor.- Type Parameters:
R- the type of values used for comparison- Parameters:
filter- the entity selection criteriaextractor- the extractor to get the values to compare withcResults- the number of highest values to return- Returns:
- the top N entities with the highest values for the specified extractor
-
topBy
public List<T> topBy(Remote.Comparator<? super T> comparator, int cResults)
Return the top N entities with the highest values for the specified extractor.- Parameters:
comparator- the comparator to use when comparing extracted valuescResults- the number of highest values to return- Returns:
- the top N entities with the highest values for the specified extractor
-
topBy
public List<T> topBy(Filter<?> filter, Remote.Comparator<? super T> comparator, int cResults)
Return the top N entities with the highest values for the specified extractor.- Parameters:
filter- the entity selection criteriacomparator- the comparator to use when comparing extracted valuescResults- the number of highest values to return- Returns:
- the top N entities with the highest values for the specified extractor
-
-