public class GridFunc extends Object
closures, predicates, and tuples.
It also contains functional style collection comprehensions.
Most of the methods in this class can be divided into two groups:
Predef in Scala) to provide general utility and functional
programming functionality in a shortest syntactical context using F
typedef.
Also note, that in all methods with predicates, null predicate has a true meaning. So does
the empty predicate array.
| Modifier and Type | Field and Description |
|---|---|
static IgnitePredicate |
EMPTY_COLLECTION |
static IgnitePredicate<String> |
EMPTY_STRING |
static IgnitePredicate<Object> |
IS_NOT_NULL |
static IgnitePredicate<Object> |
IS_NULL |
static IgnitePredicate |
NOT_EMPTY_COLLECTION |
static IgnitePredicate<String> |
NOT_EMPTY_STRING |
| Constructor and Description |
|---|
GridFunc() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> V |
addIfAbsent(ConcurrentMap<K,V> map,
K key,
Callable<V> c)
Gets the value with given key.
|
static <K,V> V |
addIfAbsent(ConcurrentMap<K,V> map,
K key,
V val)
Gets the value with given key.
|
static <K,V> V |
addIfAbsent(Map<? super K,V> map,
K key,
Callable<? extends V> c)
Utility map getter.
|
static <K,V> V |
addIfAbsent(Map<K,V> map,
K key,
V v)
Utility map getter.
|
static <T> IgnitePredicate<T> |
alwaysFalse()
Gets predicate that always returns
false. |
static <T> IgnitePredicate<T> |
alwaysTrue()
Gets predicate that always returns
true. |
static <T> IgnitePredicate<T> |
and(Collection<? extends IgnitePredicate<? super T>> ps)
Get a predicate that evaluates to
true if each of its component predicates
evaluates to true. |
static <T> IgnitePredicate<T> |
and(IgnitePredicate<? super T>... ps)
Get a predicate that evaluates to
true if each of its component predicates
evaluates to true. |
static <T> IgnitePredicate<T> |
and(IgnitePredicate<? super T>[] p1,
IgnitePredicate<? super T>... p2)
Get a predicate that evaluates to
true if each of its component predicates
evaluates to true. |
static GridAbsPredicate |
as(Callable<Boolean> c)
Converts given closure to predicate.
|
static <T> IgniteOutClosure |
as(Future<T> fut)
Converts given future into the closure.
|
static IgniteOutClosure<Boolean> |
as(GridAbsPredicate p)
Converts given predicate to closure.
|
static <T1,T2,T3> GridPredicate3<T1,T2,T3> |
as(GridClosure3<? super T1,? super T2,? super T3,Boolean> c)
Converts given closure to predicate.
|
static <X1,X2,X3> GridClosure3<X1,X2,X3,Boolean> |
as(GridPredicate3<? super X1,? super X2,? super X3> p)
Converts given predicate to closure.
|
static <T1,T2> IgniteBiPredicate<T1,T2> |
as(IgniteBiClosure<? super T1,? super T2,Boolean> c)
Converts given closure to predicate.
|
static <X1,X2> IgniteBiClosure<X1,X2,Boolean> |
as(IgniteBiPredicate<? super X1,? super X2> p)
Converts given predicate to closure.
|
static <T> IgnitePredicate<T> |
as(IgniteClosure<? super T,Boolean> c)
Converts given closure to predicate.
|
static <X> IgniteClosure<X,Boolean> |
as(IgnitePredicate<? super X> p)
Converts given predicate to closure.
|
static <T> GridIterable<T> |
as(Iterator<T> iter)
Converts given iterator into instance of
Iterable interface. |
static GridAbsClosure |
as(Runnable r)
Converts given runnable to an absolute closure.
|
static <R> IgniteOutClosure<R> |
as0(Callable<R> c)
Converts given callable to an out-closure.
|
static <E1,E2> IgnitePredicate<IgniteBiTuple<E1,E2>> |
as0(IgniteBiPredicate<? super E1,? super E2> p)
Converts predicate with two separate values to a predicate with tuple.
|
static <T> T[] |
asArray(T... t)
Convenience method to convert multiple elements into array.
|
static <T> List<T> |
asList(T... vals)
Converts array to
List. |
static <T> List<T> |
asList(T t)
Creates read-only list with given values.
|
static <K,V> Map<K,V> |
asMap(K k,
V v)
Creates map with given values.
|
static <K,V> Map<K,V> |
asMap(K k1,
V v1,
K k2,
V v2)
Creates map with given values.
|
static <K,V> Map<K,V> |
asMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3)
Creates map with given values.
|
static <K,V> Map<K,V> |
asMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4)
Creates map with given values.
|
static <K,V> Map<K,V> |
asMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3,
K k4,
V v4,
K k5,
V v5)
Creates map with given values.
|
static <T> Set<T> |
asSet(T... t)
Creates read-only set with given values.
|
static <T> Set<T> |
asSet(T t)
Creates read-only set with given value.
|
static double |
avg(Iterable<? extends Number> c)
Calculates arithmetic mean.
|
static <T extends Number> |
avgReducer()
Gets reducer closure that calculates arithmetic mean.
|
static <T> void |
awaitAll(Collection<IgniteInternalFuture<T>> futs)
Waits until all passed futures will be executed.
|
static <T> void |
awaitAll(IgniteInternalFuture<T>... futs)
Waits until all passed futures will be executed.
|
static <T> void |
awaitAll(long timeout,
Collection<IgniteInternalFuture<T>> futs)
Waits until all passed futures will be executed.
|
static <T,R> R |
awaitAll(long timeout,
IgniteReducer<T,R> rdc,
Collection<IgniteInternalFuture<T>> futs)
Awaits for all futures to complete and optionally reduces all results into one.
|
static <T> IgniteInternalFuture<T> |
awaitOne(IgniteInternalFuture<T>... futs)
Waits for one completed future from passed and returns it.
|
static <T> IgniteInternalFuture<T> |
awaitOne(Iterable<IgniteInternalFuture<T>> futs)
Waits for the first completed future from passed and returns it.
|
static <T> IgnitePredicate<T> |
breaker(boolean firstVal)
Gets breaker predicate which will return a predicate that will
evaluate to
firstVal when checked the first time,
but then will always evaluate to the opposite value. |
static <T> IgniteClosure<Callable<T>,IgniteOutClosure<T>> |
c2c()
Returns closure that converts
Callable to IgniteOutClosure. |
static <K,V> IgniteClosure<javax.cache.Cache.Entry<K,V>,V> |
cacheEntry2Get()
Gets closure that returns value for an entry.
|
static <K,V> IgniteClosure<javax.cache.Cache.Entry<K,V>,K> |
cacheEntry2Key()
Gets closure that returns key for cache entry.
|
static <K,V> IgnitePredicate<javax.cache.Cache.Entry<K,V>> |
cacheHasKeys(Collection<? extends K> keys)
Gets predicate which returns
true if entry's key is contained in given collection. |
static <K,V> IgnitePredicate<javax.cache.Cache.Entry<K,V>> |
cacheHasPeekValue()
Gets predicate which returns
true if entry has peek value. |
static GridAbsClosure |
caInvoke(Class<?> cls,
String mtdName,
Object... args)
Creates absolute closure that will reflectively call a static method with the given name.
|
static GridAbsClosure |
caInvoke(Object o,
String mtdName,
Object... args)
Creates absolute closure that will reflectively call a method with the given name on provided object.
|
static <T> IgniteInClosure<T> |
ciInvoke(String mtdName,
Object... args)
Creates in closure that will reflectively call a method with the given name on
closure's argument.
|
static <T,R> IgniteClosure<T,R> |
cInvoke(String mtdName,
Object... args)
Creates closure that will reflectively call a method with the given name on
closure's argument and return result of that call.
|
static IgniteClosure<Object,Class<?>> |
clazz()
Gets closure that converts object to its runtime class.
|
static <R> IgniteOutClosure<R> |
coInvoke(Class<?> cls,
String mtdName,
Object... args)
Creates out closure that will reflectively call a static method with the given name
and return result of that call.
|
static <R> IgniteOutClosure<R> |
coInvoke(Object o,
String mtdName,
Object... args)
Creates out closure that will reflectively call a method with the given name on provided
object and return result of that call.
|
static <D,B,C> IgniteClosure<D,C> |
compose(IgniteClosure<? super D,? extends B> f,
IgniteClosure<? super B,C> g)
Composes two closures into one.
|
static <X,Y> IgnitePredicate<X> |
compose(IgnitePredicate<? super Y> p,
IgniteClosure<? super X,? extends Y> f)
Gets a predicate that is composed of given predicate and closure.
|
static <T> Collection<T> |
concat(boolean cp,
Collection<T> c1,
Collection<T> c2)
Concatenates 2 collections into one.
|
static <T> Collection<T> |
concat(boolean cp,
T t,
Collection<T> c)
Concatenates an element to a collection.
|
static String |
concat(Iterable<String> c,
String delim)
Concatenates strings using provided delimiter.
|
static <T> Iterator<T> |
concat(Iterator<Iterator<T>> iters)
Concatenates multiple iterators as single one.
|
static <T> Iterator<T> |
concat(Iterator<T>... iters)
Concatenates multiple iterators as single one.
|
static <T> T[] |
concat(T[] arr,
T... obj)
Concatenates an elements to an array.
|
static IgniteReducer<String,String> |
concatReducer(String delim)
Gets reducer closure that concatenates strings using provided delimiter.
|
static <R> IgniteOutClosure<R> |
constant(R val)
Gets closure that returns constant value.
|
static <T1,R> IgniteClosure<T1,R> |
constant1(R val)
Gets closure that returns constant value.
|
static <T1,T2,R> IgniteBiClosure<T1,T2,R> |
constant2(R val)
Gets closure that returns constant value.
|
static <T1,T2,T3,R> |
constant3(R val)
Gets closure that returns constant value.
|
static <T> IgnitePredicate<T> |
contains(Collection<T> c)
Provides predicate which returns
true if it receives an element
that is contained in the passed in collection. |
static <T> boolean |
contains(Collection<T> c,
T t)
Checks if value is contained in the collection passed in.
|
static boolean |
contains(int[] arr,
int val) |
static boolean |
contains(Integer[] arr,
Integer val) |
static boolean |
contains(long[] arr,
long val) |
static <T> boolean |
containsAll(Collection<? extends T> c1,
Iterable<? extends T> c2)
Checks if collection
c1 contains all elements from collection c2. |
static <T> boolean |
containsAny(Collection<? extends T> c1,
Iterable<? extends T> c2)
Checks if collection
c1 contains any elements from collection c2. |
static <T> boolean |
containsAny(Collection<? extends T> c1,
T... c2)
Checks if collection
c1 contains any elements from array c2. |
static <T,R> IgniteReducer<T,R> |
continuousReducer(R elem)
Gets reducer which always returns
true from IgniteReducer.collect(Object)
method and passed in element from IgniteReducer.reduce() method. |
static <T> Collection<T> |
copy(Collection<T> to,
Iterable<? extends T> from,
IgnitePredicate<? super T>... p)
Adds (copies) to given collection using provided predicates.
|
static <T> Collection<T> |
copy(Collection<T> to,
T... from)
Adds (copies) to given collection all elements in 'from' array.
|
static <T,R> Collection<IgniteOutClosure<R>> |
curry(Collection<? extends IgniteClosure<? super T,R>> closures,
Collection<? extends T> args)
Curries collection of closures with given collection of arguments.
|
static <T,R> Collection<IgniteOutClosure<R>> |
curry(Collection<? extends IgniteClosure<? super T,R>> iter,
T arg)
Curries collection of closures with given argument.
|
static <T1,T2,R> IgniteClosure<T2,R> |
curry(IgniteBiClosure<? super T1,? super T2,R> f,
T1 e)
Curries given closure.
|
static <T,R> Collection<IgniteOutClosure<R>> |
curry(IgniteClosure<? super T,R> c,
Collection<? extends T> args)
Curries collection of closures with given collection of arguments.
|
static <T,R> IgniteOutClosure<R> |
curry(IgniteClosure<? super T,R> f,
T e)
Curries given closure.
|
static <T> Collection<GridAbsClosure> |
curry(IgniteInClosure<? super T> c,
Collection<? extends T> args)
Curries collection of closures with given collection of arguments.
|
static <T> GridAbsClosure |
curry(IgniteInClosure<? super T> f,
T e)
Curries given closure.
|
static <T> GridAbsPredicate |
curry(IgnitePredicate<? super T> f,
T e)
Curries given closure.
|
static <T,R> Collection<IgniteOutClosure<R>> |
curry(int cnt,
IgniteClosure<? super T,R> c,
IgniteOutClosure<T> pdc)
Curries collection of closures with given collection of arguments.
|
static <T> Collection<GridAbsClosure> |
curry(int cnt,
IgniteInClosure<? super T> c,
IgniteOutClosure<T> pdc)
Curries collection of closures with given collection of arguments.
|
static <T> Collection<GridAbsClosure> |
curry0(Collection<? extends IgniteInClosure<? super T>> in,
Collection<? extends T> args)
Curries collection of in closures with given collection of arguments.
|
static <T> Collection<T> |
dedup(Collection<? extends T> c)
Creates new collection by removing duplicates from the given collection.
|
static <T> Iterable<T> |
drop(Iterable<T> c,
IgnitePredicate<? super T>... p)
Removes elements in-place from given collection.
|
static <T> GridIterator<T> |
emptyIterator()
Creates new empty iterator.
|
static boolean |
eq(Object o1,
Object o2)
Tests whether specified arguments are equal, or both
null. |
static boolean |
eqArray(Object[] a1,
Object[] a2,
boolean sorted,
boolean dups)
Compares two arrays.
|
static boolean |
eqNodes(Object n1,
Object n2)
Compares two
ClusterNode instances for equality. |
static boolean |
eqNotOrdered(Collection<?> c1,
Collection<?> c2)
Checks if both collections have equal elements in any order.
|
static <K,V> boolean |
eqNotOrdered(Map<K,V> m1,
Map<K,V> m2)
Compares two maps.
|
static boolean |
eqOrdered(Collection<?> c1,
Collection<?> c2)
Checks if both collections have equal elements in the same order.
|
static <T> IgnitePredicate<T> |
equalTo(T target)
Gets predicate that evaluates to
true if its free variable is equal
to target or both are null. |
static IgnitePredicate<Event> |
eventNode(Collection<? extends ClusterNode> nodes)
Gets event predicate that returns
true only if node that produced the event
is one of the given. |
static IgnitePredicate<Event> |
eventNode(String gridName,
IgnitePredicate<ClusterNode>... p)
Gets event predicate that returns
true only if node that produced the event
satisfies all given predicates. |
static <V> boolean |
exist(Iterable<? extends V> c,
IgnitePredicate<? super V>... p)
Checks for existence of the element in input collection for which all provided predicates
evaluate to
true. |
static <K1,K extends K1,V1,V extends V1> |
exist(Map<K,V> m,
IgnitePredicate<? super Map.Entry<K,V>>... p)
Checks for existence of the entry in input map for which all provided predicates
evaluate to
true. |
static <V> boolean |
exist(V[] c,
IgnitePredicate<? super V>... p)
Checks for existence of the element in input array for which all provided predicates
evaluate to
true. |
static <T> IgniteOutClosure<T> |
factory(Class<T> cls)
Creates and returns new factory closure for the given type.
|
static <T> List<T> |
filterList(List<T> c,
boolean cp,
IgnitePredicate<T>... p)
Loses all elements in input list for which any of the predicates evaluate to
true. |
static <V> V |
find(Iterable<? extends V> c,
V dfltVal,
IgnitePredicate<? super V>... p)
Finds and returns first element in given collection for which any of the
provided predicates evaluates to
true. |
static <V,Y> Y |
find(Iterable<? extends V> c,
Y dfltVal,
IgniteClosure<? super V,Y> f,
IgnitePredicate<? super V>... p)
Finds, transforms and returns first element in given collection for which any of
the provided predicates evaluates to
true. |
static <V> V |
find(V[] c,
V dfltVal,
IgnitePredicate<? super V>... p)
Finds and returns first element in given array for which any of the provided
predicates evaluates to
true. |
static <V,Y> Y |
find(V[] c,
Y dfltVal,
IgniteClosure<? super V,Y> f,
IgnitePredicate<? super V>... p)
Finds, transforms and returns first element in given array for which any of the
provided predicates evaluates to
true. |
static <T> T |
first(Iterable<? extends T> c)
Gets first element from given collection or returns
null if the collection is empty. |
static <T> T |
first(List<? extends T> list)
Gets first element from given list or returns
null if list is empty. |
static <K,V> Map.Entry<K,V> |
firstEntry(Map<K,V> m)
Gets first key from given map or returns
null if the map is empty. |
static <K> K |
firstKey(Map<K,?> m)
Gets first key from given map or returns
null if the map is empty. |
static <V> V |
firstValue(Map<?,V> m)
Gets first value from given map or returns
null if the map is empty. |
static <T> GridIterator<T> |
flat(Iterable<? extends Iterable<T>> c)
Flattens iterable-of-iterables and returns iterable over the
elements of the inner collections.
|
static Collection<Object> |
flat0(Object... objs)
Flattens given set objects into a single collection.
|
static <T> Collection<T> |
flatCollections(Collection<? extends Collection<T>> c)
Flattens collection-of-collections and returns collection over the
elements of the inner collections.
|
static <T> Iterator<T> |
flatIterators(Iterable<Iterator<T>> c)
Flattens iterable-of-iterators and returns iterator over the
elements of the inner collections.
|
static <D,B> B |
fold(D[] c,
B b,
IgniteBiClosure<? super D,? super B,B>... fs)
Folds-right given array using provided closure.
|
static <D,B> B |
fold(Iterable<? extends D> c,
B b,
IgniteBiClosure<? super D,? super B,B>... fs)
Folds-right given collection using provided closure.
|
static <V> boolean |
forAll(Iterable<? extends V> c,
IgnitePredicate<? super V>... p)
Applies all given predicates to all elements in given input collection and returns
true if all of them evaluate to true for all elements. |
static <K1,K extends K1,V1,V extends V1> |
forAll(Map<K,V> m,
IgnitePredicate<? super Map.Entry<K,V>>... p)
Applies given predicates to all entries in given input map and returns
true
if all of them evaluates to true for all entries. |
static <V> boolean |
forAll(V[] c,
IgnitePredicate<? super V>... p)
Applies all given predicates to all elements in given input array and returns
true
if all of them evaluate to true for all elements. |
static <V> boolean |
forAny(Iterable<? extends V> c,
IgnitePredicate<? super V>... p)
Applies all given predicates to all elements in given input collection and returns
true if all predicates evaluate to true for at least one element. |
static <K1,K extends K1,V1,V extends V1> |
forAny(Map<K,V> m,
IgnitePredicate<? super Map.Entry<K,V>>... p)
Applies given predicates to all entries in given input map and returns
true
if all of them evaluates to true for at least one entry. |
static <V> boolean |
forAny(V[] c,
IgnitePredicate<? super V>... p)
Applies all given predicates to all elements in given input array and returns
true
if all of them evaluate to true for at least one element. |
static <X> void |
forEach(Iterable<? extends X> c,
IgniteInClosure<? super X> f,
IgnitePredicate<? super X>... p)
Calls given
side-effect only closure over the each element of the provided
collection. |
static <K,V> void |
forEach(Map<? extends K,? extends V> m,
IgniteInClosure<? super IgniteBiTuple<K,V>> f,
IgnitePredicate<? super IgniteBiTuple<K,V>>... p)
Calls given
side-effect only closure (if provided) over the each element of the
provided map. |
static <X> void |
forEach(X[] c,
IgniteInClosure<? super X> f,
IgnitePredicate<? super X>... p)
Calls given
side-effect only closure over the each element of the provided array. |
static <K,V> IgniteClosure<K,V> |
forMap(Map<? extends K,? extends V> m)
Gets closure that wraps given map access, i.e. returns map's value assuming that
free variable is a map's key.
|
static <K,V> IgniteClosure<K,V> |
forMap(Map<? extends K,? extends V> m,
Callable<V> c)
Gets closure that wraps given map's access, i.e. returns map's value assuming that
free variable is a map's key or default value produced by optional factory closure
if key has no mapping.
|
static double |
gavg(Iterable<? extends Number> c)
Calculates geometric mean.
|
static <T extends Number> |
gavgReducer()
Gets reducer closure that calculates geometric mean.
|
static double |
havg(Iterable<? extends Number> c)
Calculates harmonic mean.
|
static <T extends Number> |
havgReducer()
Gets reducer closure that calculates harmonic mean.
|
static IgniteClosure<UUID,String> |
id2id8()
Gets closure which converts node ID to node ID8 representation (shorter and good enough).
|
static Collection<String> |
id8s(Collection<UUID> ids)
Convenient utility method that returns collection of node ID8s for a given
collection of node IDs.
|
static <T> IgniteClosure<T,T> |
identity()
Gets identity closure, i.e. the closure that returns its variable value.
|
static IgnitePredicate<Boolean> |
identityPredicate()
Gets identity predicate, i.e. the predicate that returns its argument value.
|
static <T> IgniteReducer<T,T> |
identityReducer(T elem)
Gets reducer which always returns
true from IgniteReducer.collect(Object)
method and passed in element from IgniteReducer.reduce() method. |
static IgnitePredicate<UUID> |
idForNodeId(UUID nodeId)
Creates
UUID predicate evaluating on the given node ID. |
static IgnitePredicate<UUID> |
idForNodeIds(Collection<UUID> nodeIds)
Creates
UUID predicate evaluating on the given node IDs. |
static IgnitePredicate<UUID> |
idForNodeIds(UUID... nodeIds)
Creates
UUID predicate evaluating on the given node IDs. |
static <T> IgnitePredicate<T> |
in(Collection<? extends T> c)
Gets predicate that returns
true if its free variable is contained
in given collection. |
static <T> IgnitePredicate<T> |
in(T[] c)
Gets predicate that returns
true if its free variable is contained
in given array. |
static <T> IgnitePredicate<T> |
instanceOf(Class<?> cls)
Gets predicate that evaluates to
true if its free variable is instance of the given class. |
static <E> boolean |
intersects(Iterable<E> s1,
Collection<E>... s2)
Checks if two collections passed in intersect.
|
static <T> boolean |
isAll(T t,
IgnitePredicate<? super T>... p)
Tests if all provided predicates evaluate to
true for given value. |
static <T> boolean |
isAll(T t,
Iterable<? extends IgnitePredicate<? super T>> p)
Tests if all provided predicates evaluate to
true for given value. |
static <A,B> boolean |
isAll2(A a,
B b,
IgniteBiPredicate<? super A,? super B> p)
Tests if all provided predicates evaluate to
true for given values. |
static <A,B> boolean |
isAll2(A a,
B b,
IgniteBiPredicate<? super A,? super B>[] p)
Tests if all provided predicates evaluate to
true for given values. |
static <A,B> boolean |
isAll2(A a,
B b,
Iterable<? extends IgniteBiPredicate<? super A,? super B>> p)
Tests if all provided predicates evaluate to
true for given values. |
static <A,B,C> boolean |
isAll3(A a,
B b,
C c,
GridPredicate3<? super A,? super B,? super C>... p)
Tests if all provided predicates evaluate to
true for given values. |
static <A,B,C> boolean |
isAll3(A a,
B b,
C c,
Iterable<? extends GridPredicate3<? super A,? super B,? super C>> p)
Tests if all provided predicates evaluate to
true for given values. |
static boolean |
isAlwaysFalse(IgnitePredicate p)
Tests whether or not given predicate is the one returned from
alwaysFalse() method. |
static boolean |
isAlwaysFalse(IgnitePredicate[] p)
Tests whether or not given set of predicates consists only of one predicate returned from
alwaysFalse() method. |
static boolean |
isAlwaysTrue(IgnitePredicate p)
Tests whether or not given predicate is the one returned from
alwaysTrue() method. |
static boolean |
isAlwaysTrue(IgnitePredicate[] p)
Tests whether or not given set of predicates consists only of one predicate returned from
alwaysTrue() method. |
static <T> boolean |
isAny(T t,
IgnitePredicate<? super T>... p)
Tests if any of provided predicates evaluate to
true for given value. |
static <T> boolean |
isAny(T t,
Iterable<? extends IgnitePredicate<? super T>> p)
Tests if any of provided predicates evaluate to
true for given value. |
static <A,B> boolean |
isAny2(A a,
B b,
IgniteBiPredicate<? super A,? super B>... p)
Tests if any of provided predicates evaluate to
true for given values. |
static <A,B> boolean |
isAny2(A a,
B b,
Iterable<? extends IgniteBiPredicate<? super A,? super B>> p)
Tests if any of provided predicates evaluate to
true for given values. |
static <A,B,C> boolean |
isAny3(A a,
B b,
C c,
GridPredicate3<? super A,? super B,? super C>... p)
Tests if any of provided predicates evaluate to
true for given values. |
static <A,B,C> boolean |
isAny3(A a,
B b,
C c,
Iterable<? extends GridPredicate3<? super A,? super B,? super C>> p)
Tests if any of provided predicates evaluate to
true for given values. |
static boolean |
isEmpty(byte[] c)
Tests if the given array is either
null or empty. |
static boolean |
isEmpty(Collection<?> c)
Tests if the given collection is either
null or empty. |
static boolean |
isEmpty(int[] c)
Tests if the given array is either
null or empty. |
static boolean |
isEmpty(Iterable<?> c)
Tests if the given collection is either
null or empty. |
static boolean |
isEmpty(long[] c)
Tests if the given array is either
null or empty. |
static boolean |
isEmpty(Map<?,?> m)
Tests if the given map is either
null or empty. |
static boolean |
isEmpty(String s)
Tests if given string is
null or empty. |
static <T> boolean |
isEmpty(T[] c)
Tests if the given array is either
null or empty. |
static <T> IgnitePredicate<Collection<T>> |
isEmptyCollection()
Gets predicate which checks if collection is
null or empty. |
static <T> boolean |
isEmptyOrNulls(T[] c)
Tests if the given array is
null, empty or contains only null values. |
static IgnitePredicate<String> |
isEmptyString()
Gets predicate which checks if string is
null or empty. |
static <T> IgnitePredicate<Collection<T>> |
isNotEmptyCollection()
Gets predicate which checks if collection is not
null or empty. |
static IgnitePredicate<String> |
isNotEmptyString()
Gets predicate which checks if string is not
null or empty. |
static <T> IgnitePredicate<T> |
isNull()
Gets predicate that evaluates to
true if its free variable is null. |
static <T> GridIterable<T> |
iterable(Iterable<? extends T> c,
IgnitePredicate<? super T>... p)
Creates and returns iterable from given collection and optional filtering predicates.
|
static <T1,T2> GridIterator<T2> |
iterator(Iterable<? extends T1> c,
IgniteClosure<? super T1,T2> trans,
boolean readOnly,
IgnitePredicate<? super T1>... p)
Creates and returns transforming iterator from given collection and optional
filtering predicates.
|
static <T1,T2> Iterator<T2> |
iterator(Iterator<? extends T1> c,
IgniteClosure<? super T1,T2> trans,
boolean readOnly,
IgnitePredicate<? super T1>... p) |
static <T> GridIterator<T> |
iterator0(Iterable<? extends T> c,
boolean readOnly,
IgnitePredicate<? super T>... p)
Creates and returns iterator from given collection and optional filtering predicates.
|
static <T> Collection<T> |
jobResults(Collection<? extends ComputeJobResult> res)
Gets collections of data items from grid job res casted to specified type.
|
static <T> T |
last(Iterable<? extends T> c)
Gets last element from given collection or returns
null if the collection is empty. |
static <E> Collection<E> |
limit(Collection<E> col,
int limit) |
static GridAbsPredicate |
limit(int n)
Gets absolute (no-arg) predicate that returns
true first n-times
it's called - and false thereafter. |
static <E> Set<E> |
limit(Set<E> col,
int limit) |
static <T extends ClusterNode> |
localNode(UUID locNodeId)
Gets predicate that evaluates to
true only for given local node ID. |
static <T> Collection<T> |
lose(Collection<? extends T> c,
boolean cp,
int num)
Loses up to first
num elements of the input collection. |
static <T0,T extends T0> |
lose(Collection<T> c,
boolean cp,
Collection<T0> filter)
Loses all elements in input collection that are contained in
filter collection. |
static <T> Collection<T> |
lose(Collection<T> c,
boolean cp,
IgnitePredicate<? super T>... p)
Loses all elements in input collection that are evaluated to
true by
all given predicates. |
static <K,V> Map<K,V> |
lose(Map<K,V> m,
boolean cp,
IgnitePredicate<? super Map.Entry<K,V>>... p)
Loses all entries in input map that are evaluated to
true by all given predicates. |
static <K,V> Map<K,V> |
loseKeys(Map<K,V> m,
boolean cp,
IgnitePredicate<? super K>... p)
Loses all entries in input map which keys are evaluated to
true by all
given predicates. |
static <T> List<T> |
loseList(List<T> c,
boolean cp,
Collection<? super T> filter)
Loses all elements in input list that are contained in
filter collection. |
static <T> Set<T> |
loseSet(Set<T> c,
boolean cp,
Collection<? super T> filter)
Loses all elements in input set that are contained in
filter collection. |
static <K,V> Map<K,V> |
loseValues(Map<K,V> m,
boolean cp,
IgnitePredicate<? super V>... p)
Loses all entries in input map which values are evaluated to
true by all
given predicates. |
static <K> IgniteClosure<Map.Entry<K,?>,K> |
mapEntry2Key()
Gets closure that returns key for an entry.
|
static <V> IgniteClosure<Map.Entry<?,V>,V> |
mapEntry2Value()
Gets closure that returns value for an entry.
|
static <K,V> IgnitePredicate<Map.Entry<K,V>> |
mapKey(K key)
Gets utility predicate that accepts
java.util.Map.Entry value and compares its key
to the given value. |
static <K,V> IgnitePredicate<Map.Entry<K,V>> |
mapValue(V val)
Gets utility predicate that accepts
Map.Entry value and compares
its value to the given value. |
static IgniteCallable<AtomicBoolean> |
newAtomicBoolean()
Returns a factory closure that creates new
AtomicBoolean instance
initialized to false. |
static IgniteCallable<AtomicInteger> |
newAtomicInt()
Returns a factory closure that creates new
AtomicInteger instance
initialized to zero. |
static IgniteCallable<AtomicLong> |
newAtomicLong()
Returns a factory closure that creates new
AtomicLong instance
initialized to zero. |
static <T> IgniteCallable<AtomicReference<T>> |
newAtomicRef()
Returns a factory closure that creates new
AtomicReference instance
initialized to null. |
static <K,V> IgniteCallable<ConcurrentMap<K,V>> |
newCMap()
Returns a factory closure that creates new
ConcurrentMap instance. |
static <E> IgniteCallable<Set<E>> |
newCSet()
Returns a factory closure that creates new
GridConcurrentHashSet instance. |
static <T> IgniteCallable<ConcurrentLinkedDeque8<T>> |
newDeque()
Returns a factory closure that creates new
ConcurrentLinkedDeque8 instance. |
static <T> IgniteCallable<LinkedList<T>> |
newLinkedList()
Returns a factory closure that creates new
LinkedList instance. |
static <T> IgniteCallable<List<T>> |
newList()
Returns a factory closure that creates new
List instance. |
static <K,V> IgniteCallable<Map<K,V>> |
newMap()
Returns a factory closure that creates new
Map instance. |
static <T> IgniteCallable<Set<T>> |
newSet()
Returns a factory closure that creates new
Set instance. |
static <T> IgniteOutClosure<T> |
nill()
Returns out closure that always returns
null. |
static IgniteClosure<ClusterNode,UUID> |
node2id()
Gets closure which converts node to node ID.
|
static IgniteClosure<ClusterNode,String> |
node2id8()
Gets closure which converts node to node ID8 representation (shorter and good enough).
|
static <T> Collection<T> |
nodeAttributes(Collection<? extends ClusterNode> nodes,
String attr)
Convenient utility method that returns collection of node attributes for a given
collection of grid nodes.
|
static <T extends ClusterNode> |
nodeForNodeId(UUID nodeId)
Creates grid node predicate evaluating on the given node ID.
|
static <T extends ClusterNode> |
nodeForNodeIds(Collection<UUID> nodeIds)
Creates grid node predicate evaluating on the given node IDs.
|
static <T extends ClusterNode> |
nodeForNodeIds(UUID... nodeIds)
Creates grid node predicate evaluating on the given node IDs.
|
static IgnitePredicate<ClusterNode> |
nodeForNodes(ClusterNode... nodes)
Creates predicates that evaluates to
true for each node in given collection. |
static IgnitePredicate<ClusterNode> |
nodeForNodes(Collection<? extends ClusterNode> nodes)
Creates predicates that evaluates to
true for each node in given collection. |
static Collection<String> |
nodeId8s(Collection<? extends ClusterNode> nodes)
Convenient utility method that returns collection of node ID8s for a given
collection of grid nodes.
|
static Collection<UUID> |
nodeIds(Collection<? extends ClusterNode> nodes)
Convenient utility method that returns collection of node IDs for a given
collection of grid nodes.
|
static GridAbsClosure |
noop()
Creates an absolute (no-arg) closure that does nothing.
|
static <T> IgnitePredicate<T> |
not(IgnitePredicate<? super T>... p)
Negates given predicates.
|
static <T> IgnitePredicate<T> |
notContains(Collection<T> c)
Provides predicate which returns
true if it receives an element
that is not contained in the passed in collection. |
static <T> IgnitePredicate<T> |
notEqualTo(T target)
Gets predicate that evaluates to
true if its free variable is not equal
to target or both are null. |
static <T> IgnitePredicate<T> |
notIn(Collection<? extends T> c)
Gets predicate that returns
true if its free variable is not
contained in given collection. |
static <T> IgnitePredicate<T> |
notIn(T[] c)
Gets predicate that returns
true if its free variable is not
contained in given array. |
static <T> IgnitePredicate<T> |
notInstanceOf(Class<?> cls)
Gets predicate that evaluates to
true if its free variable is not an instance
of the given class. |
static <T> IgnitePredicate<T> |
notNull()
Gets predicate that evaluates to
true if its free variable is not null. |
static <T> IgnitePredicate<T> |
or(Collection<? extends IgnitePredicate<? super T>> ps)
Get a predicate that evaluates to
true if any of its component
predicates evaluates to true. |
static <T> IgnitePredicate<T> |
or(IgnitePredicate<? super T>... ps)
Get a predicate that evaluates to
true if any of its component predicates
evaluates to true. |
static <T> IgnitePredicate<T> |
or(IgnitePredicate<? super T>[] p1,
IgnitePredicate<? super T>... p2)
Get a predicate that evaluates to
true if any of its component predicates
evaluates to true. |
static <T> IgnitePair<T> |
pair(T t1,
T t2)
Creates pair out of given two objects.
|
static <V> IgniteBiTuple<Collection<V>,Collection<V>> |
partition(Iterable<? extends V> c,
IgnitePredicate<? super V> p)
Partitions input collection in two: first containing elements for which given
predicate evaluates to
true - and second containing the elements for which
predicate evaluates to false. |
static <K,V> IgniteBiTuple<Map<K,V>,Map<K,V>> |
partition(Map<? extends K,? extends V> m,
IgniteBiPredicate<? super K,? super V> p)
Partitions input map in two: first containing entries for which given predicate evaluates
to
true - and second containing the entries for which predicate evaluates to false. |
static <V> IgniteBiTuple<Collection<V>,Collection<V>> |
partition(V[] c,
IgnitePredicate<? super V> p)
Partitions input array in two: first containing elements for which given predicate
evaluates to
true - and second containing the elements for which predicate
evaluates to false. |
static IgniteClosure<ClusterGroup,IgnitePredicate<ClusterNode>> |
predicate()
Gets closure that transform a grid projection into its predicate.
|
static <T> IgniteInClosure<T> |
print()
Gets closure that prints out its bound variable
|
static GridAbsClosure |
print(String msg)
Creates absolute closure that does System.out.print(msg).
|
static <T> IgniteInClosure<T> |
print(String pre,
String post)
Gets closure that prints out its bound variable.
|
static <T> IgniteInClosure<T> |
printf(String fmt)
Gets closure that prints out its bound variable.
|
static <T> IgniteInClosure<T> |
println()
Gets closure that calls
System.out.println() on its bound variable. |
static GridAbsClosure |
println(String msg)
Creates absolute closure that does System.out.println(msg).
|
static <T> IgniteInClosure<T> |
println(String pre,
String post)
Gets closure that prints out its bound variable.
|
static double |
qavg(Iterable<? extends Number> c)
Calculates quadratic mean.
|
static <T extends Number> |
qavgReducer()
Gets reducer closure that calculates quadratic mean.
|
static IgniteClosure<Runnable,GridAbsClosure> |
r2c()
Returns closure that converts
Runnable to GridAbsClosure. |
static <T> T |
rand(Collection<? extends T> c)
Gets random value from given collection.
|
static <T> T |
rand(List<T> l)
Gets random value from given list.
|
static <T> T |
rand(T... c)
Gets random value from given array.
|
static <T> T |
randConcurrent(Collection<? extends T> c)
Gets random value from given collection which may be modified concurrently.
|
static List<Integer> |
range(int fromIncl,
int toExcl)
Creates a range list containing numbers in given range.
|
static <X,Y> Y |
reduce(Iterable<? extends X> c,
IgniteReducer<? super X,Y> f)
Reduces collection into single value using given for-all closure.
|
static <X,Y,R> R |
reduce(Map<? extends X,? extends Y> m,
IgniteReducer2<? super X,? super Y,R> f)
Reduces given map into single value using given for-all closure.
|
static <T extends ClusterNode> |
remoteNodes(UUID locNodeId)
Gets predicate that evaluates to
false for given local node ID. |
static <T0,T extends T0> |
retain(Collection<T> c,
boolean cp,
Collection<? extends T0> filter)
Retains all elements in input collection that are contained in
filter. |
static <T> Collection<T> |
retain(Collection<T> c,
boolean cp,
IgnitePredicate<? super T>... p)
Retains all elements in input collection that are evaluated to
true
by all given predicates. |
static <T> Collection<T> |
retain(Collection<T> c,
boolean cp,
int num)
Retains only up to first
num elements in the input collection. |
static <K,V> Map<K,V> |
retain(Map<K,V> m,
boolean cp,
IgnitePredicate<? super Map.Entry<K,V>>... p)
For a given map retains all map entries that satisfy all provided predicates.
|
static <K,V> Map<K,V> |
retainKeys(Map<K,V> m,
boolean cp,
IgnitePredicate<? super K>... p)
For a given map retains all map entries which keys satisfy all provided predicates.
|
static <K,V> Map<K,V> |
retainValues(Map<K,V> m,
boolean cp,
IgnitePredicate<? super V>... p)
For a given map retains all map entries which values satisfy all provided predicates.
|
static <K,V> V |
returnIfAbsent(Map<? extends K,? extends V> map,
K key,
Callable<V> c)
Utility map getter.
|
static <T> IgniteReducer<T,T> |
singleReducer()
Gets reducer closure that collects only a single value and returns it
without any transformations.
|
static <T> int |
size(Collection<? extends T> c,
IgnitePredicate<? super T>... p)
Gets size of the given collection with provided optional predicates.
|
static <T> int |
size(Iterator<? extends T> it,
IgnitePredicate<? super T>... p)
Gets size of the given iterator with provided optional predicates.
|
static <T> int |
size(T[] c,
IgnitePredicate<? super T>... p)
Gets size of the given array with provided optional predicates.
|
static <T0,T extends T0> |
split(Collection<T> c,
IgnitePredicate<? super T>... p)
Splits given collection in two using provided set of predicates.
|
static <T> IgniteClosure<T,String> |
string()
Gets closure that return
toString() value for its free variable. |
static BigDecimal |
sumBigDecimal(Iterable<BigDecimal> c)
Calculates sum of all elements.
|
static IgniteReducer<BigDecimal,BigDecimal> |
sumBigDecimalReducer()
Gets reducer closure that calculates sum of all elements.
|
static BigInteger |
sumBigInt(Iterable<BigInteger> c)
Calculates sum of all elements.
|
static IgniteReducer<BigInteger,BigInteger> |
sumBigIntegerReducer()
Gets reducer closure that calculates sum of all elements.
|
static double |
sumDouble(Iterable<Double> c)
Calculates sum of all elements.
|
static IgniteReducer<Double,Double> |
sumDoubleReducer()
Gets reducer closure that calculates sum of all elements.
|
static int |
sumInt(Iterable<Integer> c)
Calculates sum of all elements.
|
static IgniteReducer<Integer,Integer> |
sumIntReducer()
Gets reducer closure that calculates sum of integer elements.
|
static IgniteReducer<Long,Long> |
sumLongReducer()
Gets reducer closure that calculates sum of long integer elements.
|
static <V> GridTuple<V> |
t(V v)
Factory method returning new tuple with given parameter.
|
static <V1,V2> IgniteBiTuple<V1,V2> |
t(V1 v1,
V2 v2)
Factory method returning new tuple with given parameters.
|
static <V1,V2,V3> GridTuple3<V1,V2,V3> |
t(V1 v1,
V2 v2,
V3 v3)
Factory method returning new tuple with given parameters.
|
static <V1,V2,V3,V4> |
t(V1 v1,
V2 v2,
V3 v3,
V4 v4)
Factory method returning new tuple with given parameters.
|
static <V1,V2,V3,V4,V5> |
t(V1 v1,
V2 v2,
V3 v3,
V4 v4,
V5 v5)
Factory method returning new tuple with given parameters.
|
static <V1,V2,V3,V4,V5,V6> |
t(V1 v1,
V2 v2,
V3 v3,
V4 v4,
V5 v5,
V6 v6)
Factory method returning new tuple with given parameters.
|
static <V> GridTuple<V> |
t1()
Factory method returning empty tuple.
|
static <V1,V2> IgniteBiTuple<V1,V2> |
t2()
Factory method returning new empty tuple.
|
static <V1,V2,V3> GridTuple3<V1,V2,V3> |
t3()
Factory method returning new empty tuple.
|
static <V1,V2,V3,V4> |
t4()
Factory method returning new empty tuple.
|
static <V1,V2,V3,V4,V5> |
t5()
Factory method returning new empty tuple.
|
static <V1,V2,V3,V4,V5,V6> |
t6()
Factory method returning new empty tuple.
|
static <X,Y> Collection<Y> |
transform(Collection<? extends X> c,
IgniteClosure<? super X,Y> f)
Transforms one collection to another using provided closure.
|
static <X,Y> Collection<Y> |
transform(Collection<? extends X> c,
IgniteClosure<? super X,Y> f,
IgnitePredicate<? super X>... p)
Transforms one collection to another using provided closure and optional set of
predicates.
|
static <X,Y> Collection<Y> |
transform(Collection<Y> to,
Iterable<? extends X> from,
IgniteClosure<? super X,Y> f,
IgnitePredicate<? super X>... p)
Transforms one collection to another using provided closure and predicate.
|
static <X,Y> Collection<Y> |
transform(X[] c,
IgniteClosure<? super X,Y> f)
Transforms an array to read only collection using provided closure.
|
static <T1,T2> List<T2> |
transformList(Collection<? extends T1> c,
IgniteClosure<? super T1,T2> trans,
IgnitePredicate<? super T1>... p)
Creates a view on given list with provided transformer and predicates.
|
static <T1,T2> Set<T2> |
transformSet(Collection<? extends T1> c,
IgniteClosure<? super T1,T2> trans,
IgnitePredicate<? super T1>... p)
Creates a view on given set with provided transformer and predicates.
|
static <T> GridTriple<T> |
triple(T t1,
T t2,
T t3)
Creates triple out of given three objects.
|
static GridTupleV |
tv(Object... objs)
Creates vararg tuple with given values.
|
static IgnitePredicate<IgniteInternalFuture<?>> |
unfinishedFutures()
Returns predicate for filtering unfinished futures.
|
static <T extends R,R> |
upcast(Collection<T> c)
Upcasts collection type.
|
static <T> Collection<T> |
view(Collection<T> c,
IgnitePredicate<? super T>... p)
Creates write-through light-weight view on given collection with provided predicates.
|
static <K0,K extends K0,V0,V extends V0> |
view(Map<K,V> m,
IgnitePredicate<? super K>... p)
Creates light-weight view on given map with provided predicates.
|
static <K0,K extends K0,V0,V extends V0> |
viewAsMap(Set<K> c,
IgniteClosure<? super K,V> mapClo,
IgnitePredicate<? super K>... p)
Read-only map view of a collection.
|
static <T1,T2> List<T2> |
viewListReadOnly(List<? extends T1> c,
IgniteClosure<? super T1,T2> trans)
Creates read-only light-weight view on given list with provided transformation.
|
static <T1,T2> Collection<T2> |
viewReadOnly(Collection<? extends T1> c,
IgniteClosure<? super T1,T2> trans,
IgnitePredicate<? super T1>... p)
Creates read-only light-weight view on given collection with transformation and provided
predicates.
|
static <K0,K extends K0,V0,V extends V0,V1> |
viewReadOnly(Map<K,V> m,
IgniteBiClosure<K,V,V1> trans,
IgnitePredicate<? super K>... p)
Read-only view on map that supports transformation of values and key filtering.
|
static <K0,K extends K0,V0,V extends V0,V1> |
viewReadOnly(Map<K,V> m,
IgniteClosure<V,V1> trans,
IgnitePredicate<? super K>... p)
Read-only view on map that supports transformation of values and key filtering.
|
static double |
wavg(Collection<? extends Number> c,
Collection<? extends Number> w)
Calculates weighted mean.
|
static GridClosureException |
wrap(Throwable e)
Shortcut method that creates an instance of
GridClosureException. |
static <T,R> Collection<IgniteOutClosure<R>> |
yield(Collection<? extends T> c,
IgniteClosure<? super T,R> f)
Given collection of items and a closure this method returns
read only collection of closures where each closure is closed on an element
of the initial collection.
|
static <T> Collection<GridAbsClosure> |
yield(Collection<? extends T> c,
IgniteInClosure<? super T> f)
Given collection of items and a closure this method returns read-only collection of
closures where each closure is closed on an element of the initial collection.
|
static <T,R> Collection<IgniteOutClosure<R>> |
yield(T[] c,
IgniteClosure<? super T,R> f)
Given array of items and a closure this method returns collection
of closures where each closure is closed on a element of the array.
|
static <T> Collection<GridAbsClosure> |
yield(T[] c,
IgniteInClosure<? super T> f)
Given collection of items and a closure this method returns collection
of closures where each closure is closed on an element of the initial collection.
|
static <K,V> Map<K,V> |
zip(Collection<? extends K> keys,
Collection<? extends V> vals)
Converts 2 collections into map using first collection as keys and second
collection as values.
|
static <K,V> Map<K,V> |
zip(Collection<? extends K> keys,
V dfltVal)
Converts collection to map using collection values as keys and
passed in default value as values.
|
public static final IgnitePredicate<Object> IS_NULL
public static final IgnitePredicate<Object> IS_NOT_NULL
public static final IgnitePredicate<String> EMPTY_STRING
public static final IgnitePredicate<String> NOT_EMPTY_STRING
public static final IgnitePredicate EMPTY_COLLECTION
public static final IgnitePredicate NOT_EMPTY_COLLECTION
public static <T> IgnitePredicate<T> breaker(boolean firstVal)
firstVal when checked the first time,
but then will always evaluate to the opposite value.T - Predicate type.firstVal - First value.public static IgniteClosure<ClusterGroup,IgnitePredicate<ClusterNode>> predicate()
public static <T extends ClusterNode> IgnitePredicate<T> localNode(UUID locNodeId)
true only for given local node ID.T - Type of the node.locNodeId - Local node ID.true only for the node with given local node ID.public static <T extends ClusterNode> IgnitePredicate<T> remoteNodes(UUID locNodeId)
false for given local node ID.T - Type of the node.locNodeId - Local node ID.false for the given local node ID.public static <T> IgniteOutClosure<T> nill()
null.null.public static <T,R> IgniteClosure<T,R> cInvoke(String mtdName, Object... args)
Method reflects the typedef for IgniteClosure which is C1.
R - Type of closure return value.T - Type of closure argument.mtdName - Method name.args - Optional set of arguments for the method call.GridClosureException - Thrown in case of any reflective invocation errors.public static <T> IgniteInClosure<T> ciInvoke(String mtdName, Object... args)
Method reflects the typedef for IgniteClosure which is C1.
T - Type of closure argument.mtdName - Method name.args - Optional set of arguments for the method call.GridClosureException - Thrown in case of any reflective invocation errors.public static <R> IgniteOutClosure<R> coInvoke(Object o, String mtdName, Object... args)
Method reflects the typedef for IgniteOutClosure which is CO.
R - Type of closure return value.o - Target object to call the method on.mtdName - Method name.args - Optional set of arguments for the method call.GridClosureException - Thrown in case of any reflective invocation errors.public static GridAbsClosure caInvoke(Object o, String mtdName, @Nullable Object... args)
Method reflects the typedef for GridAbsClosure which is CA.
o - Target object to call the method on.mtdName - Method name.args - Optional set of arguments for the method call.GridClosureException - Thrown in case of any reflective invocation errors.public static <R> IgniteOutClosure<R> coInvoke(Class<?> cls, String mtdName, @Nullable Object... args)
Method reflects the typedef for IgniteOutClosure which is CO.
R - Type of closure return value.cls - Class to call a static method on.mtdName - Method name.args - Optional set of arguments for the method call.GridClosureException - Thrown in case of any reflective invocation errors.public static GridAbsClosure caInvoke(Class<?> cls, String mtdName, @Nullable Object... args)
Method reflects the typedef for GridAbsClosure which is CA.
cls - Class to call a static method on.mtdName - Method name.args - Optional set of arguments for the method call.GridClosureException - Thrown in case of any reflective invocation errors.public static IgniteClosure<Object,Class<?>> clazz()
public static <T> Collection<T> dedup(Collection<? extends T> c)
T - Type of the collection.c - Collection to remove duplicates from.public static int sumInt(Iterable<Integer> c)

c - Collection of elements.public static double sumDouble(Iterable<Double> c)

c - Collection of elements.public static BigDecimal sumBigDecimal(Iterable<BigDecimal> c)

c - Collection of elements.public static BigInteger sumBigInt(Iterable<BigInteger> c)

c - Collection of elements.public static double avg(Iterable<? extends Number> c)

c - Input collection.public static <T extends Number> IgniteReducer<T,Double> avgReducer()

public static double qavg(Iterable<? extends Number> c)

c - Input collection.public static <T extends Number> IgniteReducer<T,Double> qavgReducer()

public static double gavg(Iterable<? extends Number> c)

c - Input collection.public static <T extends Number> IgniteReducer<T,Double> gavgReducer()

public static double wavg(Collection<? extends Number> c, Collection<? extends Number> w)

c - Collection of elements.w - Collection of weights.public static double havg(Iterable<? extends Number> c)

c - Input collection.public static <T> IgniteReducer<T,T> singleReducer()
public static <T,R> IgniteReducer<T,R> continuousReducer(R elem)
true from IgniteReducer.collect(Object)
method and passed in element from IgniteReducer.reduce() method.T - Reducer element type.R - Return element type.elem - Element to return from IgniteReducer.reduce() method.public static <T> IgniteReducer<T,T> identityReducer(T elem)
true from IgniteReducer.collect(Object)
method and passed in element from IgniteReducer.reduce() method.T - Reducer element type.elem - Element to return from IgniteReducer.reduce() method.public static <T extends Number> IgniteReducer<T,Double> havgReducer()

public static IgniteReducer<Integer,Integer> sumIntReducer()

public static IgniteReducer<Long,Long> sumLongReducer()

public static IgniteReducer<Double,Double> sumDoubleReducer()

public static List<Integer> range(int fromIncl, int toExcl)
fromIncl - Inclusive start of the range.toExcl - Exclusive stop of the range.public static IgniteReducer<BigDecimal,BigDecimal> sumBigDecimalReducer()

public static IgniteReducer<BigInteger,BigInteger> sumBigIntegerReducer()

public static IgniteReducer<String,String> concatReducer(@Nullable String delim)
delim - Delimiter (optional).public static String concat(Iterable<String> c, @Nullable String delim)
c - Input collection.delim - Delimiter (optional).public static <T> Collection<T> jobResults(@Nullable Collection<? extends ComputeJobResult> res)
Here's the typical example of how this method is used in reduce() method
implementation (this example sums up all the values of Integer type):
public Integer reduce(List<GridComputeJobResult> res) throws IgniteCheckedException {
return F.sum(F.<Integer>jobResults(res));
}
Note that this method doesn't create a new collection but simply iterates over the input one.
T - Type of the data item to cast to. See ComputeJobResult.getData() method.res - Collection of grid job res.T.ComputeJobResult.getData()public static Collection<UUID> nodeIds(@Nullable Collection<? extends ClusterNode> nodes)
Note that this method doesn't create a new collection but simply iterates over the input one.
nodes - Collection of grid nodes.public static Collection<String> nodeId8s(@Nullable Collection<? extends ClusterNode> nodes)
Note that this method doesn't create a new collection but simply iterates over the input one.
nodes - Collection of grid nodes.public static Collection<String> id8s(@Nullable Collection<UUID> ids)
Note that this method doesn't create a new collection but simply iterates over the input one.
ids - Collection of nodeIds.public static <T> Collection<T> nodeAttributes(Collection<? extends ClusterNode> nodes, String attr)
Note that this method doesn't create a new collection but simply iterates over the input one.
T - Type of the attribute.nodes - Collection of grid nodes.attr - Name of the attribute to return from each node.public static <T> IgniteInClosure<T> println()
System.out.println() on its bound variable.T - Type of the bound variable.System.out.println() on its bound variable.public static GridAbsClosure println(String msg)
msg - Message to print.public static GridAbsClosure print(String msg)
msg - Message to print.public static <T> IgniteInClosure<T> println(@Nullable String pre, @Nullable String post)
T - Type of the bound variable.pre - String value to print before each variable.post - String value to print after each variable.System.out.print(pre); System.out.print(t); System.out.println(post)
on its bound variable.public static <T> IgniteInClosure<T> printf(String fmt)
T - Type of the bound variable.fmt - Format string as for PrintStream.printf(String, Object...) method.public static <T> IgniteInClosure<T> print()
public static <T> IgniteInClosure<T> print(@Nullable String pre, @Nullable String post)
pre - String value to print before each variable.post - String value to print after each variable.public static <T> T rand(Collection<? extends T> c)
T - Type of the collection.c - Input collection (no null and not emtpy).@Nullable public static <T> T randConcurrent(Collection<? extends T> c)
T - Type of the collection.c - Input collection.public static <T> T rand(List<T> l)
T - Type of the list elements.l - Input collection.public static <T> T rand(T... c)
T - Type of the collection.c - Input collection.public static <T> Collection<T> concat(boolean cp, @Nullable T t, @Nullable Collection<T> c)
copy flag is true, then
a new collection will be created and the element and passed in collection will be
copied into the new one. The returned collection will be modifiable. If copy
flag is false, then a read-only view will be created over the element and given
collections and no copying will happen.T - Element type.cp - Copy flag.t - First element.c - Second collection.public static <T> Collection<T> concat(boolean cp, @Nullable Collection<T> c1, @Nullable Collection<T> c2)
copy flag is true, then
a new collection will be created and these collections will be copied into the
new one. The returned collection will be modifiable. If copy flag is
false, then a read-only view will be created over given collections
and no copying will happen.T - Element type.cp - Copy flag.c1 - First collection.c2 - Second collection.non-null collection.public static <T> T[] concat(@Nullable T[] arr, T... obj)
arr - Array.obj - One or more elements.public static <T> Iterator<T> concat(Iterator<T>... iters)
iters - Iterators.public static <T> Iterator<T> concat(Iterator<Iterator<T>> iters)
iters - Iterator over iterators.public static <T0,T extends T0> Collection<T> lose(Collection<T> c, boolean cp, @Nullable Collection<T0> filter)
filter collection.T - Type of collections.c - Input collection.cp - If true method creates new collection not modifying input,
otherwise does in-place modifications.filter - Filter collection. If filter collection is empty or
null - no elements are lost.public static <T> Collection<T> lose(Collection<T> c, boolean cp, @Nullable IgnitePredicate<? super T>... p)
true by
all given predicates.T - Type of collections.c - Input collection.cp - If true method creates new collection without modifying the input one,
otherwise does in-place modifications.p - Predicates to filter by. If no predicates provided - no elements are lost.public static <T> Collection<T> lose(Collection<? extends T> c, boolean cp, int num)
num elements of the input collection.T - Type of the collections.c - Input collection.cp - If true method creates new collection not modifying input,
otherwise does in-place modifications.num - Maximum number of elements to lose (the actual number can be
less if the input collection contains less elements).public static <K,V> Map<K,V> lose(Map<K,V> m, boolean cp, @Nullable IgnitePredicate<? super Map.Entry<K,V>>... p)
true by all given predicates.K - Type of the free variable for the predicate and type of map's keys.V - Type of the free variable for the predicate and type of map's values.m - Map to filter.cp - If true method creates new map not modifying input, otherwise does
in-place modifications.p - Optional set of predicates to use for filtration. If none provided - original map
will (or its copy) be returned.public static <K,V> Map<K,V> loseKeys(Map<K,V> m, boolean cp, @Nullable IgnitePredicate<? super K>... p)
true by all
given predicates.K - Type of the free variable for the predicate and type of map's keys.V - Type of map's values.m - Map to filter.cp - If true method creates new map not modifying input, otherwise does
in-place modifications.p - Optional set of predicates to use for filtration. If none provided - original
map (or its copy) will be returned.public static <K,V> Map<K,V> loseValues(Map<K,V> m, boolean cp, @Nullable IgnitePredicate<? super V>... p)
true by all
given predicates.K - Type of the free variable for the predicate and type of map's keys.V - Type of map's values.m - Map to filter.cp - If true method creates new map not modifying input, otherwise does
in-place modifications.p - Optional set of predicates to use for filtration. If none provided - original
map (or its copy) will be returned.public static <T> List<T> loseList(List<T> c, boolean cp, @Nullable Collection<? super T> filter)
filter collection.T - Type of list.c - Input list.cp - If true method creates new list not modifying input,
otherwise does in-place modifications.filter - Filter collection. If filter collection is empty or
null - no elements are lost.public static <T> List<T> filterList(List<T> c, boolean cp, @Nullable IgnitePredicate<T>... p)
true.T - Type of list.c - Input list.cp - If true method creates new list not modifying input,
otherwise does in-place modifications.p - Looses all elements for which any of the predicates evaluate to true.public static <T> Set<T> loseSet(Set<T> c, boolean cp, @Nullable Collection<? super T> filter)
filter collection.T - Type of set.c - Input set.cp - If true method creates new list not modifying input,
otherwise does in-place modifications.filter - Filter collection. If filter collection is empty or
null - no elements are lost.public static <T> Iterable<T> drop(Iterable<T> c, @Nullable IgnitePredicate<? super T>... p)
true will be removed from the
passed in collection. Note that collection must support removal.T - Type of the collection.c - Input collection that should support removal.p - Optional set of predicates. If no predicates provided - no elements will be
dropped and input collection will be returned.public static IgniteClosure<ClusterNode,UUID> node2id()
public static IgniteClosure<ClusterNode,String> node2id8()
public static IgniteClosure<UUID,String> id2id8()
public static <T extends ClusterNode> IgnitePredicate<T> nodeForNodeId(UUID nodeId)
nodeId - Node ID for which returning predicate will evaluate to true.idForNodeId(UUID),
nodeIds(Collection)public static <T extends ClusterNode> IgnitePredicate<T> nodeForNodeIds(@Nullable Collection<UUID> nodeIds)
nodeIds - Collection of node IDs.idForNodeId(UUID),
nodeIds(Collection)public static <T extends ClusterNode> IgnitePredicate<T> nodeForNodeIds(@Nullable UUID... nodeIds)
nodeIds - Collection of node IDs.idForNodeId(UUID),
nodeIds(Collection)public static IgnitePredicate<UUID> idForNodeId(UUID nodeId)
UUID predicate evaluating on the given node ID.nodeId - Node ID for which returning predicate will evaluate to true.UUID predicate evaluating on the given node ID.nodeForNodeId(UUID),
nodeIds(Collection)public static IgnitePredicate<UUID> idForNodeIds(@Nullable Collection<UUID> nodeIds)
UUID predicate evaluating on the given node IDs.nodeIds - Collection of node IDs.UUID predicate evaluating on the given node IDs.nodeForNodeId(UUID),
nodeIds(Collection)public static IgnitePredicate<UUID> idForNodeIds(@Nullable UUID... nodeIds)
UUID predicate evaluating on the given node IDs.nodeIds - Collection of node IDs.UUID predicate evaluating on the given node IDs.nodeForNodeId(UUID),
nodeIds(Collection)public static IgnitePredicate<ClusterNode> nodeForNodes(@Nullable Collection<? extends ClusterNode> nodes)
true for each node in given collection.
Note that is collection is empty the result predicate will always evaluate to false.
Implementation simply creates GridNodePredicate instance.nodes - Collection of nodes. If none provided - result predicate will always
return false.true for each node in given collection.public static IgnitePredicate<ClusterNode> nodeForNodes(ClusterNode... nodes)
true for each node in given collection.
Note that if collection is empty the result predicate will always evaluate to false.
Implementation simply creates GridNodePredicate instance.nodes - Collection of nodes. If none provided - result predicate will always
return false.true for each node in given collection.public static <T0,T extends T0> Collection<T> retain(Collection<T> c, boolean cp, @Nullable Collection<? extends T0> filter)
filter.T - Type of collections.c - Input collection.cp - If true method creates collection not modifying input, otherwise does
in-place modifications.filter - Filter collection. If filter collection is null or empty -
an empty collection will be returned.public static <T> Collection<T> retain(Collection<T> c, boolean cp, @Nullable IgnitePredicate<? super T>... p)
true
by all given predicates.T - Type of collections.c - Input collection.cp - If true method creates collection not modifying input, otherwise does
in-place modifications.p - Predicates to filter by. If no predicates provides - all elements
will be retained.public static <T> Collection<T> retain(Collection<T> c, boolean cp, int num)
num elements in the input collection.T - Type of the collections.c - Input collection.cp - If true method creates collection not modifying input, otherwise does
in-place modifications.num - Maximum number of elements to retain (the actual number can be
less if the input collection contains less elements).num first elements from the input collection.public static <K,V> Map<K,V> retain(Map<K,V> m, boolean cp, @Nullable IgnitePredicate<? super Map.Entry<K,V>>... p)
K - Type of the free variable for the predicate and type of map's keys.V - Type of map's values.m - Map to retain entries from.cp - If true method creates new map not modifying input, otherwise does
in-place modifications.p - Optional set of predicate to use for filtration. If none provided - original
map (or its copy) will be returned.public static <K,V> Map<K,V> retainKeys(Map<K,V> m, boolean cp, @Nullable IgnitePredicate<? super K>... p)
K - Type of the free variable for the predicate and type of map's keys.V - Type of map's values.m - Map to retain entries from.cp - If true method creates new map not modifying input, otherwise does
in-place modifications.p - Optional set of predicate to use for filtration. If none provided - original
map (or its copy) will be returned.public static <K,V> Map<K,V> retainValues(Map<K,V> m, boolean cp, @Nullable IgnitePredicate<? super V>... p)
K - Type of the free variable for the predicate and type of map's keys.V - Type of map's values.m - Map to retain entries from.cp - If true method creates new map not modifying input, otherwise does
in-place modifications.p - Optional set of predicate to use for filtration. If none provided - original
map (or its copy) will be returned.public static <T> IgniteOutClosure as(Future<T> fut)
apply
method is called it will call Future.get() method.T - Type of the future and closure.fut - Future to convert.public static <E1,E2> IgnitePredicate<IgniteBiTuple<E1,E2>> as0(IgniteBiPredicate<? super E1,? super E2> p)
E1 - Type of the 1st value.E2 - Type of the 2nd value.p - Predicate to convert.public static <T,R> IgniteOutClosure<R> curry(IgniteClosure<? super T,R> f, T e)
T - Input type.R - Output type.f - Closure.e - Parameter.public static <T1,T2,R> IgniteClosure<T2,R> curry(IgniteBiClosure<? super T1,? super T2,R> f, T1 e)
T1 - Input type1.T2 - Input type2.R - Output type.f - Closure.e - Parameter.public static <T> GridAbsPredicate curry(IgnitePredicate<? super T> f, T e)
T - Input type.f - Closure.e - Parameter.public static <T> GridAbsClosure curry(IgniteInClosure<? super T> f, T e)
T - Input type.f - Closure.e - Parameter.public static <T,R> Collection<IgniteOutClosure<R>> yield(Collection<? extends T> c, IgniteClosure<? super T,R> f)
T - Type of the input collection.R - Type of the return value for the closure.c - Input collection of elements.f - Closure to close on each element of input collection.public static <T> Collection<GridAbsClosure> yield(Collection<? extends T> c, IgniteInClosure<? super T> f)
T - Type of the input collection.c - Input collection of elements.f - Closure to close on each element of input collection.public static <T> Collection<GridAbsClosure> yield(T[] c, IgniteInClosure<? super T> f)
T - Type of the input collection.c - Input collection of elements.f - Closure to close on each element of input collection.public static <T,R> Collection<IgniteOutClosure<R>> yield(T[] c, IgniteClosure<? super T,R> f)
T - Type of the input collection.R - Type of the return value for the closure.c - Input array of elements.f - Closure to close on each element of array.public static <T> GridIterable<T> as(Iterator<T> iter)
Iterable interface.T - Type of the iterator.iter - Iterator to convert.public static <T> List<T> asList(@Nullable T... vals)
List. Note that resulting list cannot
be altered in size, as it it based on the passed in array -
only current elements can be changed.
Note that unlike Arrays.asList(Object[]), this method is
null-safe. If null is passed in, then empty list
will be returned.
T - Array type.vals - Array of valuesList instance for array.public static <T> GridIterator<T> emptyIterator()
T - Type of the iterator.public static <T> Collection<T> flatCollections(@Nullable Collection<? extends Collection<T>> c)
Note that due to non-copying nature of implementation, the
size() method of resulting collection will have to
iterate over all elements to produce size. Method isEmpty(),
however, is constant time and is much more preferable to use instead
of 'size()' method when checking if list is not empty.
T - Type of the inner collections.c - Input collection of collections.public static <T> GridIterator<T> flat(@Nullable Iterable<? extends Iterable<T>> c)
T - Type of the inner collections.c - Input collection of collections.public static <T> Iterator<T> flatIterators(@Nullable Iterable<Iterator<T>> c)
c - Input iterable of iterators.public static Collection<Object> flat0(@Nullable Object... objs)
Collection,
Iterable and Object[] objects.objs - Objects to flatten.public static <E> Collection<E> limit(Collection<E> col, int limit)
col - Collection.limit - Limit.limit elements.public static <E> Set<E> limit(Set<E> col, int limit)
col - Collection.limit - Limit.limit elements.public static GridAbsClosure as(@Nullable Runnable r)
r - Runnable to convert to closure. If null - no-op closure is returned.null.public static IgniteClosure<Runnable,GridAbsClosure> r2c()
Runnable to GridAbsClosure.Runnable to GridAbsClosure.public static <T> IgniteClosure<Callable<T>,IgniteOutClosure<T>> c2c()
Callable to IgniteOutClosure.Callable to IgniteOutClosure.public static <R> IgniteOutClosure<R> as0(Callable<R> c)
c - Callable to convert to closure.IgniteException.public static <T> int size(T[] c,
@Nullable
IgnitePredicate<? super T>... p)
T - Type of the array.c - Array to size.p - Optional predicates that filters out elements from count.true. If no predicates is provided - all elements are counted.public static <T> int size(@Nullable Collection<? extends T> c, @Nullable IgnitePredicate<? super T>... p)
T - Type of the iterator.c - Collection to size.p - Optional predicates that filters out elements from count.true. If no predicates is provided - all elements are counted.public static <T> int size(@Nullable Iterator<? extends T> it, @Nullable IgnitePredicate<? super T>... p)
T - Type of the iterator.it - Iterator to size.p - Optional predicates that filters out elements from count.true. If no predicates is provided - all elements are counted.public static <T> Collection<T> view(@Nullable Collection<T> c, @Nullable IgnitePredicate<? super T>... p)
true. Note that only wrapping collection will be created and no duplication of
data will occur. Also note that if array of given predicates is not empty then method
size() uses full iteration through the collection.T - Type of the collection.c - Input collection that serves as a base for the view.p - Optional predicates. If predicates are not provided - all elements will be in the view.public static <T1,T2> Collection<T2> viewReadOnly(@Nullable Collection<? extends T1> c, IgniteClosure<? super T1,T2> trans, @Nullable IgnitePredicate<? super T1>... p)
transformed elements for which
all provided predicate, if any, evaluates to true. Note that only wrapping
collection will be created and no duplication of data will occur. Also note that if array
of given predicates is not empty then method size() uses full iteration through
the collection.T1 - Type of the collection.c - Input collection that serves as a base for the view.trans - Transformation closure.p - Optional predicated. If predicates are not provided - all elements will be in the view.public static <T1,T2> List<T2> viewListReadOnly(@Nullable List<? extends T1> c, IgniteClosure<? super T1,T2> trans)
transformed elements. Note that only wrapping
list will be created and no duplication of data will occur.T1 - Type of the list.c - Input list that serves as a base for the view.trans - Transformation closure.public static <T1,T2> List<T2> transformList(Collection<? extends T1> c, IgniteClosure<? super T1,T2> trans, @Nullable IgnitePredicate<? super T1>... p)
true. Note that a new collection will be created and data will
be copied.c - Input list that serves as a base for the view.trans - Transforming closure from T1 to T2.p - Optional predicates. If predicates are not provided - all elements will be in the view.public static <T1,T2> Set<T2> transformSet(Collection<? extends T1> c, IgniteClosure<? super T1,T2> trans, @Nullable IgnitePredicate<? super T1>... p)
true.
Note that a new collection will be created and data will be copied.c - Input set that serves as a base for the view.trans - Transforming closure from T1 to T2.p - Optional predicates. If predicates are not provided - all elements will be in the view.public static <K0,K extends K0,V0,V extends V0> Map<K,V> view(@Nullable Map<K,V> m, @Nullable IgnitePredicate<? super K>... p)
true.
Note that only wrapping map will be created and no duplication of data will occur.
Also note that if array of given predicates is not empty then method size()
uses full iteration through the entry set.K - Type of the key.V - Type of the value.m - Input map that serves as a base for the view.p - Optional predicates. If predicates are not provided - all will be in the view.public static <K0,K extends K0,V0,V extends V0,V1> Map<K,V1> viewReadOnly(@Nullable Map<K,V> m, IgniteClosure<V,V1> trans, @Nullable IgnitePredicate<? super K>... p)
true.
Note that only wrapping map will be created and no duplication of data will occur.
Also note that if array of given predicates is not empty then method size()
uses full iteration through the entry set.K - Type of the key.V - Type of the input map value.V1 - Type of the output map value.m - Input map that serves as a base for the view.trans - Transformer for map value transformation.p - Optional predicates. If predicates are not provided - all will be in the view.public static <K0,K extends K0,V0,V extends V0,V1> Map<K,V1> viewReadOnly(@Nullable Map<K,V> m, IgniteBiClosure<K,V,V1> trans, @Nullable IgnitePredicate<? super K>... p)
true.
Note that only wrapping map will be created and no duplication of data will occur.
Also note that if array of given predicates is not empty then method size()
uses full iteration through the entry set.K - Type of the key.V - Type of the input map value.V1 - Type of the output map value.m - Input map that serves as a base for the view.trans - Transformer for map value transformation.p - Optional predicates. If predicates are not provided - all will be in the view.public static <K0,K extends K0,V0,V extends V0> Map<K,V> viewAsMap(@Nullable Set<K> c, IgniteClosure<? super K,V> mapClo, @Nullable IgnitePredicate<? super K>... p)
true. Note that only wrapping map will be created and no duplication of data will occur.
Also note that if array of given predicates is not empty then method size()
uses full iteration through the entry set.K - Key type.V - Value type.c - Input collection.mapClo - Mapping closure, that maps key to value.p - Optional predicates to filter input collection. If predicates are not provided - all
elements will be in the view.public static boolean isEmpty(@Nullable String s)
null or empty.s - String to test.null or empty.public static <T> boolean isEmpty(@Nullable T[] c)
null or empty.c - Array to test.null or empty.public static <T> boolean isEmptyOrNulls(@Nullable T[] c)
null, empty or contains only null values.c - Array to test.null, empty or contains only null values.public static boolean isEmpty(@Nullable int[] c)
null or empty.c - Array to test.null or empty.public static boolean isEmpty(@Nullable byte[] c)
null or empty.c - Array to test.null or empty.public static boolean isEmpty(@Nullable long[] c)
null or empty.c - Array to test.null or empty.public static boolean isEmpty(@Nullable Iterable<?> c)
null or empty.c - Collection to test.null or empty.public static boolean isEmpty(@Nullable Collection<?> c)
null or empty.c - Collection to test.null or empty.public static boolean isEmpty(@Nullable Map<?,?> m)
null or empty.m - Map to test.null or empty.@Nullable public static <K,V> V returnIfAbsent(Map<? extends K,? extends V> map, @Nullable K key, @Nullable Callable<V> c)
addIfAbsent(Map, Object, Callable)
method but this one doesn't put the default value into the map when key is not found.K - Map key type.V - Map value type.map - Map to get value from.key - Map key (can be null).c - Optional factory closure for the default value to be returned in
when key is not found. If closure is not provided - null will be returned.key or default value produced by c if key is not
found (or null if key is not found and closure is not provided).GridClosureException - Thrown in case when callable throws exception.newLinkedList(),
newList(),
newSet(),
newMap(),
newAtomicLong(),
newAtomicInt(),
newAtomicRef(),
newAtomicBoolean()public static <T> IgniteCallable<ConcurrentLinkedDeque8<T>> newDeque()
ConcurrentLinkedDeque8 instance.
Note that this method does not create a new closure but returns a static one.T - Type parameters for the created List.List instance every
time its IgniteOutClosure.apply() method is called.public static <T> IgniteCallable<List<T>> newList()
List instance. Note that this
method does not create a new closure but returns a static one.T - Type parameters for the created List.List instance every
time its IgniteOutClosure.apply() method is called.public static IgniteCallable<AtomicInteger> newAtomicInt()
AtomicInteger instance
initialized to zero. Note that this method does not create a new
closure but returns a static one.AtomicInteger instance
initialized to zero every time its IgniteOutClosure.apply() method is called.public static IgniteCallable<AtomicLong> newAtomicLong()
AtomicLong instance
initialized to zero. Note that this method does not create a new
closure but returns a static one.AtomicLong instance
initialized to zero every time its IgniteOutClosure.apply() method is called.public static <T> IgniteCallable<AtomicReference<T>> newAtomicRef()
AtomicReference instance
initialized to null. Note that this method does not create a new closure
but returns a static one.T - Type of the atomic reference.AtomicReference instance
initialized to null every time its IgniteOutClosure.apply() method is called.public static IgniteCallable<AtomicBoolean> newAtomicBoolean()
AtomicBoolean instance
initialized to false. Note that this method does not create a new
closure but returns a static one.AtomicBoolean instance
initialized to false every time its IgniteOutClosure.apply() method is called.public static <T> IgniteCallable<LinkedList<T>> newLinkedList()
LinkedList instance.
Note that this method does not create a new closure but returns a static one.T - Type parameters for the created LinkedList.LinkedList instance every time its IgniteOutClosure.apply() method is called.public static <T> IgniteCallable<Set<T>> newSet()
Set instance. Note that this
method does not create a new closure but returns a static one.T - Type parameters for the created Set.Set instance every time
its IgniteOutClosure.apply() method is called.public static <K,V> IgniteCallable<Map<K,V>> newMap()
Map instance. Note
that this method does not create a new closure but returns a static one.K - Type of the key for the created Map.V - Type of the value for the created Map.Map instance every
time its IgniteOutClosure.apply() method is called.public static <K,V> IgniteCallable<ConcurrentMap<K,V>> newCMap()
ConcurrentMap instance.
Note that this method does not create a new closure but returns a static one.K - Type of the key for the created ConcurrentMap.V - Type of the value for the created ConcurrentMap.Map instance every
time its IgniteOutClosure.apply() method is called.public static <E> IgniteCallable<Set<E>> newCSet()
GridConcurrentHashSet instance.
Note that this method does not create a new closure but returns a static one.GridConcurrentHashSet instance every
time its IgniteOutClosure.apply() method is called.public static <T> GridIterable<T> iterable(Iterable<? extends T> c, IgnitePredicate<? super T>... p)
true. Note that this method will not create new collection but
will simply "skip" elements in the provided collection that given predicates doesn't
evaluate to true for.T - Type of the collection elements.c - Input collection.p - Optional filtering predicates.public static <T> GridIterator<T> iterator0(Iterable<? extends T> c, boolean readOnly, IgnitePredicate<? super T>... p)
true (if provided). Note that this method will not create new collection but
will simply "skip" elements in the provided collection that given predicates doesn't
evaluate to true for.T - Type of the collection elements.c - Input collection.readOnly - If true, then resulting iterator will not allow modifications
to the underlying collection.p - Optional filtering predicates.public static <T1,T2> GridIterator<T2> iterator(Iterable<? extends T1> c, IgniteClosure<? super T1,T2> trans, boolean readOnly, @Nullable IgnitePredicate<? super T1>... p)
true ( if provided). Note that this method
will not create new collection but will simply "skip" elements in the provided
collection that given predicates doesn't evaluate to true for.T1 - Type of the collection elements.T2 - Type of returned elements.c - Input collection.trans - Transforming closure to convert from T1 to T2.readOnly - If true, then resulting iterator will not allow modifications
to the underlying collection.p - Optional filtering predicates.public static <T1,T2> Iterator<T2> iterator(Iterator<? extends T1> c, IgniteClosure<? super T1,T2> trans, boolean readOnly, @Nullable IgnitePredicate<? super T1>... p)
c - Input iterator.trans - Transforming closure to convert from T1 to T2.readOnly - If true, then resulting iterator will not allow modifications
to the underlying collection.p - Optional filtering predicates.public static <T> IgnitePredicate<T> alwaysTrue()
true. This method returns
constant predicate.T - Type of the free variable, i.e. the element the predicate is called on.true.public static <T> IgnitePredicate<T> alwaysFalse()
false. This method returns
constant predicate.T - Type of the free variable, i.e. the element the predicate is called on.false.public static boolean isAlwaysTrue(IgnitePredicate p)
alwaysTrue() method.p - Predicate to check.true if given predicate is ALWAYS_TRUE predicate.public static boolean isAlwaysTrue(@Nullable IgnitePredicate[] p)
alwaysTrue() method.p - Predicate to check.true if given contains only ALWAYS_TRUE predicate.public static boolean isAlwaysFalse(IgnitePredicate p)
alwaysFalse() method.p - Predicate to check.true if given predicate is ALWAYS_FALSE predicate.public static boolean isAlwaysFalse(@Nullable IgnitePredicate[] p)
alwaysFalse() method.p - Predicate to check.true if given contains only ALWAYS_FALSE predicate.public static <T> IgnitePredicate<T> isNull()
true if its free variable is null.T - Type of the free variable, i.e. the element the predicate is called on.true if its free variable is null.public static <T> IgnitePredicate<T> notNull()
true if its free variable is not null.T - Type of the free variable, i.e. the element the predicate is called on.true if its free variable is not null.public static IgnitePredicate<String> isEmptyString()
null or empty.null or empty.public static IgnitePredicate<String> isNotEmptyString()
null or empty.null or empty.public static <T> IgnitePredicate<Collection<T>> isEmptyCollection()
null or empty.T - Type of collection element.public static <T> IgnitePredicate<Collection<T>> isNotEmptyCollection()
null or empty.T - Type of collection element.null or empty.public static <T> IgnitePredicate<T> not(@Nullable IgnitePredicate<? super T>... p)
Gets predicate that evaluates to true if any of given predicates
evaluates to false. If all predicates evaluate to true the
result predicate will evaluate to false.
T - Type of the free variable, i.e. the element the predicate is called on.p - Predicate to negate.public static <T> IgnitePredicate<T> equalTo(@Nullable T target)
true if its free variable is equal
to target or both are null.T - Type of the free variable, i.e. the element the predicate is called on.target - Object to compare free variable to.true if its free variable is equal to
target or both are null.public static <T> IgnitePredicate<T> notEqualTo(@Nullable T target)
true if its free variable is not equal
to target or both are null.T - Type of the free variable, i.e. the element the predicate is called on.target - Object to compare free variable to.true if its free variable is not equal
to target or both are null.public static <T> IgnitePredicate<T> instanceOf(Class<?> cls)
true if its free variable is instance of the given class.T - Type of the free variable, i.e. the element the predicate is called on.cls - Class to compare to.true if its free variable is instance
of the given class.public static <T> IgnitePredicate<T> notInstanceOf(Class<?> cls)
true if its free variable is not an instance
of the given class.T - Type of the free variable, i.e. the element the predicate is called on.cls - Class to compare to.true if its free variable is not an instance
of the given class.public static <T> T first(@Nullable Iterable<? extends T> c)
null if the collection is empty.T - Type of the collection.c - A collection.null in case if the collection is empty.public static <T> T first(List<? extends T> list)
null if list is empty.list - List.null in case if list is empty.@Nullable public static <T> T last(@Nullable Iterable<? extends T> c)
null if the collection is empty.T - Type of the collection.c - A collection.null in case if the collection is empty.@Nullable public static <V> V firstValue(Map<?,V> m)
null if the map is empty.V - Value type.m - A map.null in case if the map is empty.@Nullable public static <K> K firstKey(Map<K,?> m)
null if the map is empty.K - Key type.m - A map.null in case if the map is empty.@Nullable public static <K,V> Map.Entry<K,V> firstEntry(Map<K,V> m)
null if the map is empty.K - Key type.V - Value type.m - A map.null in case if the map is empty.public static <T> IgnitePredicate<T> and(@Nullable Collection<? extends IgnitePredicate<? super T>> ps)
true if each of its component predicates
evaluates to true. The components are evaluated in order they are supplied.
Evaluation will be stopped as soon as first predicate evaluates to false.
Passed in predicates are NOT copied. If no predicates are passed in the returned
predicate will always evaluate to false.T - Type of the free variable, i.e. the element the predicate is called on.ps - Passed in predicate.true if each of its component predicates
evaluates to true.public static <T> IgnitePredicate<T> and(@Nullable IgnitePredicate<? super T>[] p1, @Nullable IgnitePredicate<? super T>... p2)
true if each of its component predicates
evaluates to true. The components are evaluated in order they are supplied.
Evaluation will be stopped as soon as first predicate evaluates to false.
Passed in predicates are NOT copied. If no predicates are passed in the returned
predicate will always evaluate to false.T - Type of the free variable, i.e. the element the predicate is called on.p1 - Passed in predicates.p2 - Passed in predicates.true if each of its component predicates
evaluates to true.public static <T> IgnitePredicate<T> and(@Nullable IgnitePredicate<? super T>... ps)
true if each of its component predicates
evaluates to true. The components are evaluated in order they are supplied.
Evaluation will be stopped as soon as first predicate evaluates to false.
Passed in predicates are NOT copied. If no predicates are passed in the returned
predicate will always evaluate to false.T - Type of the free variable, i.e. the element the predicate is called on.ps - Passed in predicate. If none provided - always-false predicate is
returned.true if each of its component predicates
evaluates to true.public static <T> IgnitePredicate<T> or(@Nullable Collection<? extends IgnitePredicate<? super T>> ps)
true if any of its component
predicates evaluates to true. The components are evaluated in order
they are supplied. Evaluation will be stopped as soon as first predicate
evaluates to true. Passed in predicates are NOT copied. If no predicates
are passed in the returned predicate will always evaluate to false.T - Type of the free variable, i.e. the element the predicate is called on.ps - Passed in predicate.true if any of its component predicates
evaluates to true.public static <T> IgnitePredicate<T> or(@Nullable IgnitePredicate<? super T>[] p1, @Nullable IgnitePredicate<? super T>... p2)
true if any of its component predicates
evaluates to true. The components are evaluated in order they are supplied.
Evaluation will be stopped as soon as first predicate evaluates to false.
Passed in predicates are NOT copied. If no predicates are passed in the returned
predicate will always evaluate to false.T - Type of the free variable, i.e. the element the predicate is called on.p1 - Passed in predicates.p2 - Passed in predicates.true if any of its component predicates
evaluates to true.public static <T> IgnitePredicate<T> or(@Nullable IgnitePredicate<? super T>... ps)
true if any of its component predicates
evaluates to true. The components are evaluated in order they are supplied.
Evaluation will be stopped as soon as first predicate evaluates to true.
Passed in predicates are NOT copied. If no predicates are passed in the returned
predicate will always evaluate to false.T - Type of the free variable, i.e. the element the predicate is called on.ps - Passed in predicate.true if any of its component predicates evaluates
to true.public static <X,Y> IgnitePredicate<X> compose(IgnitePredicate<? super Y> p, IgniteClosure<? super X,? extends Y> f)
x
it returns predicate p(f(x)). Note that predicate and closure must be loaded
by the same class loader.X - Type of the free variable for the closure.Y - Type of the closure's return value.p - Predicate.f - Closure.public static <T1,R> IgniteClosure<T1,R> constant1(@Nullable R val)
T1 - Type of the free variable for the closure.R - Type of the closure's return value.val - Constant value to return.public static <T1,T2,R> IgniteBiClosure<T1,T2,R> constant2(@Nullable R val)
T1 - Type of the free variable for the closure.T2 - Type of the free variable for the closure.R - Type of the closure's return value.val - Constant value to return.public static <T1,T2,T3,R> GridClosure3<T1,T2,T3,R> constant3(@Nullable R val)
T1 - Type of the free variable for the closure.T2 - Type of the free variable for the closure.T3 - Type of the free variable for the closure.R - Type of the closure's return value.val - Constant value to return.public static <R> IgniteOutClosure<R> constant(@Nullable R val)
R - Type of the closure's return value.val - Constant value to return.public static <T> IgniteOutClosure<T> factory(Class<T> cls)
T - Type of factory.cls - Class of factory.public static <T> IgniteClosure<T,T> identity()
T - Type of the variable and return value for the closure.public static IgnitePredicate<Boolean> identityPredicate()
public static GridAbsPredicate as(Callable<Boolean> c)
c - Closure to convert.public static <T> IgnitePredicate<T> as(IgniteClosure<? super T,Boolean> c)
c - Closure to convert.public static <T1,T2> IgniteBiPredicate<T1,T2> as(IgniteBiClosure<? super T1,? super T2,Boolean> c)
c - Closure to convert.public static <T1,T2,T3> GridPredicate3<T1,T2,T3> as(GridClosure3<? super T1,? super T2,? super T3,Boolean> c)
c - Closure to convert.public static IgniteOutClosure<Boolean> as(GridAbsPredicate p)
p - Predicate to convert.public static <X> IgniteClosure<X,Boolean> as(IgnitePredicate<? super X> p)
X - Type of the free variable for the predicate.p - Predicate to convert.public static <X1,X2> IgniteBiClosure<X1,X2,Boolean> as(IgniteBiPredicate<? super X1,? super X2> p)
X1 - Type of the free variable for the predicate.X2 - Type of the free variable for the predicate.p - Predicate to convert.public static <X1,X2,X3> GridClosure3<X1,X2,X3,Boolean> as(GridPredicate3<? super X1,? super X2,? super X3> p)
X1 - Type of the free variable for the predicate.X2 - Type of the free variable for the predicate.X3 - Type of the free variable for the predicate.p - Predicate to convert.public static <D,B,C> IgniteClosure<D,C> compose(IgniteClosure<? super D,? extends B> f, IgniteClosure<? super B,C> g)
a is a free variable the
result closure is g.apply(f.apply(a)). Note that both closures
must be loaded by the same class loader.D - Type of the free variable for the closure.B - Type of return value and of the free variable for the closure.C - Type of the return value for the closure.f - First closure.g - Second closure.public static <K,V> IgniteClosure<K,V> forMap(Map<? extends K,? extends V> m)
K - Type of the free variable for the closure and type of the map keys.V - Type of the closure's return value and type of the map values.m - Source map.public static <K,V> IgniteClosure<K,V> forMap(Map<? extends K,? extends V> m, @Nullable Callable<V> c)
K - Type of the free variable for the closure and type of the map keys.V - Type of the closure's return value and type of the map values.m - Source map.c - Optional factory closure to produce default value to return from result closure if
key has no mapping in given map. If factory closure is null - the default value
will be null.public static <T> IgniteClosure<T,String> string()
toString() value for its free variable.T - Type of the free variable for the closure.toString() value for its free variable.public static <T> IgnitePredicate<T> in(@Nullable Collection<? extends T> c)
true if its free variable is contained
in given collection.T - Type of the free variable for the predicate and type of the
collection elements.c - Collection to check for containment.true if its free variable is
contained in given collection.public static <T> IgnitePredicate<T> notIn(@Nullable Collection<? extends T> c)
true if its free variable is not
contained in given collection.T - Type of the free variable for the predicate and type of the
collection elements.c - Collection to check for containment.true if its free variable is not
contained in given collection.public static <K,V> V addIfAbsent(ConcurrentMap<K,V> map, K key, @Nullable Callable<V> c)
null return null.K - Key type.V - Value type.map - Concurrent hash map.key - Key to get the value for.c - Default value producing closure.null if key is not found and
closure is null.public static <K,V> V addIfAbsent(ConcurrentMap<K,V> map, K key, V val)
K - Key type.V - Value type.map - Map.key - Key.val - Value to put if one does not exist.@Nullable public static <K,V> V addIfAbsent(Map<? super K,V> map, @Nullable K key, @Nullable Callable<? extends V> c)
K - Map key type.V - Map value type.map - Map to get value from.key - Map key (can be null).c - Optional factory closure for the default value to be put in when key
is not found. If closure is not provided - null will be put into the map.key or default value produced by c if key is not
found (or null if key is not found and closure is not provided). Note that
in case when key is not found the default value will be put into the map.GridClosureException - Thrown in case when callable throws exception.newLinkedList(),
newList(),
newSet(),
newMap(),
newAtomicLong(),
newAtomicInt(),
newAtomicRef(),
newAtomicBoolean()@Nullable public static <K,V> V addIfAbsent(Map<K,V> map, @Nullable K key, @Nullable V v)
K - Map key type.V - Map value type.map - Map to get value from.key - Map key (can be null).v - Optional value to be put in when key is not found.
If not provided - null will be put into the map.key or default value c if key is not
found (or null if key is not found and value is not provided). Note that
in case when key is not found the default value will be put into the map.public static <T> IgnitePredicate<T> in(@Nullable T[] c)
true if its free variable is contained
in given array.T - Type of the free variable for the predicate and type of the
array elements.c - Array to check for containment.true if its free variable is
contained in given array.public static <T> IgnitePredicate<T> notIn(@Nullable T[] c)
true if its free variable is not
contained in given array.T - Type of the free variable for the predicate and type of the
array elements.c - Array to check for containment.true if its free variable is not
contained in given array.public static <X,Y> Y reduce(Iterable<? extends X> c, IgniteReducer<? super X,Y> f)
X - Type of the free variable for the closure and type of the
collection elements.Y - Type of the closure's return value.c - Collection to reduce.f - For-all closure used for reduction.@Nullable public static <X,Y,R> R reduce(Map<? extends X,? extends Y> m, IgniteReducer2<? super X,? super Y,R> f)
X - Type of the free variable for the closure and type of the map keys.Y - Type of the closure's return value and type of the map values.R - Type of the return value for the closure.m - Map to reduce.f - For-all closure used for reduction.public static <X> void forEach(Iterable<? extends X> c, IgniteInClosure<? super X> f, @Nullable IgnitePredicate<? super X>... p)
side-effect only closure over the each element of the provided
collection.X - Type of the free variable for the closure and type of the
collection elements.c - Collection to call closure over.f - Side-effect only closure to call over the collection.p - Optional set of predicates. Only if collection element evaluates
to true for given predicates the closure will be applied to it.
If no predicates provided - closure will be applied to all collection
elements.public static <X> void forEach(X[] c,
IgniteInClosure<? super X> f,
@Nullable
IgnitePredicate<? super X>... p)
side-effect only closure over the each element of the provided array.X - Type of the free variable for the closure and type of the array
elements.c - Array to call closure over.f - Side-effect only closure to call over the array.p - Optional set of predicates. Only if collection element evaluates
to true for given predicates the closure will be applied to it.
If no predicates provided - closure will be applied to all collection
elements.public static <T> Collection<T> copy(Collection<T> to, T... from)
T - Type of the free variable for the predicate and type of the collection elements.to - Collection to copy to.from - Array to copy from.public static <T> Collection<T> copy(Collection<T> to, Iterable<? extends T> from, @Nullable IgnitePredicate<? super T>... p)
true.T - Type of the free variable for the predicate and type of the collection elements.to - Collection to copy to.from - Collection to copy from.p - Optional set of predicates to use for filtration.public static <X,Y> Collection<Y> transform(Collection<Y> to, Iterable<? extends X> from, IgniteClosure<? super X,Y> f, @Nullable IgnitePredicate<? super X>... p)
true
for this value. Note that no new collection will be created.X - Type of the free variable for the closure and type of the collection elements.Y - Type of the closure's return value.to - Destination collection to transform to.from - Initial collection to transform.f - Closure to use for transformation.p - Optional predicates to use for transformation.public static <K,V> void forEach(Map<? extends K,? extends V> m, IgniteInClosure<? super IgniteBiTuple<K,V>> f, @Nullable IgnitePredicate<? super IgniteBiTuple<K,V>>... p)
side-effect only closure (if provided) over the each element of the
provided map. If provided closure is null this method is no-op.K - Type of the free variable for the closure and type of the map keys.V - Type of the closure's return value and type of the map values.m - Map to call closure over.f - Optional closure to call over the map.p - Optional set of predicates. Only if map entry evaluates to true for given
predicates the closure will be applied to it. If no predicates provided - closure will
be applied to all map entries.public static <X,Y> Collection<Y> transform(Collection<? extends X> c, IgniteClosure<? super X,Y> f)
X - Type of the free variable for the closure and type of the collection elements.Y - Type of the closure's return value.c - Initial collection to transform.f - Closure to use for transformation.public static <T extends R,R> Collection<R> upcast(Collection<T> c)
c - Initial collection.public static <X,Y> Collection<Y> transform(X[] c, IgniteClosure<? super X,Y> f)
X - Type of the free variable for the closure and type of the array elements.Y - Type of the closure's return value.c - Initial array to transform.f - Closure to use for transformation.public static <T> boolean isAll(@Nullable T t, @Nullable IgnitePredicate<? super T>... p)
true for given value. Note that
evaluation will be short-circuit when first predicate evaluated to false is found.T - Type of the value and free variable of the predicates.t - Value to test.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return true.true if given set of predicates is null, is empty, or all predicates
evaluate to true for given value, false otherwise.public static <T> boolean isAll(@Nullable T t, @Nullable Iterable<? extends IgnitePredicate<? super T>> p)
true for given value. Note that evaluation will be
short-circuit when first predicate evaluated to false is found.T - Type of the value and free variable of the predicates.t - Value to test.p - Optional set of predicates to use for evaluation.true if given set of predicates is null, is empty, or all predicates
evaluate to true for given value, false otherwise.public static <A,B> boolean isAll2(@Nullable A a, @Nullable B b, @Nullable IgniteBiPredicate<? super A,? super B> p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to false is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return true.true if all predicates evaluate to true for given
values, false otherwise.public static <A,B> boolean isAll2(@Nullable A a, @Nullable B b, @Nullable IgniteBiPredicate<? super A,? super B>[] p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to false is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return true.true if all predicates evaluate to true for given
values, false otherwise.public static <A,B> boolean isAll2(@Nullable A a, @Nullable B b, @Nullable Iterable<? extends IgniteBiPredicate<? super A,? super B>> p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to false is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return true.true if all predicates evaluate to true for given
values, false otherwise.public static <A,B,C> boolean isAll3(@Nullable A a, @Nullable B b, @Nullable C c, @Nullable GridPredicate3<? super A,? super B,? super C>... p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to false is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.C - Type of the 3d value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.c - 3d value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return true.true if all predicates evaluate to true for given
values, false otherwise.public static <A,B,C> boolean isAll3(@Nullable A a, @Nullable B b, @Nullable C c, @Nullable Iterable<? extends GridPredicate3<? super A,? super B,? super C>> p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to false is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.C - Type of the 3d value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.c - 3d value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return true.true if all predicates evaluate to true for given
values, false otherwise.public static <T> boolean isAny(@Nullable T t, @Nullable IgnitePredicate<? super T>... p)
true for given value. Note
that evaluation will be short-circuit when first predicate evaluated to true
is found.T - Type of the value and free variable of the predicates.t - Value to test.p - Optional set of predicates to use for evaluation.true if any of predicates evaluates to true for given
value, false otherwise. Returns false if given set of predicates
is null or empty.public static <T> boolean isAny(@Nullable T t, @Nullable Iterable<? extends IgnitePredicate<? super T>> p)
true for given value. Note
that evaluation will be short-circuit when first predicate evaluated to true
is found.T - Type of the value and free variable of the predicates.t - Value to test.p - Optional set of predicates to use for evaluation.true if any of predicates evaluates to true for given
value, false otherwise. Returns false if given set of predicates
is null or empty.public static <A,B> boolean isAny2(@Nullable A a, @Nullable B b, @Nullable IgniteBiPredicate<? super A,? super B>... p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to true is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return false.true if any of predicates evaluate to true for given
values, false otherwise.public static <A,B> boolean isAny2(@Nullable A a, @Nullable B b, @Nullable Iterable<? extends IgniteBiPredicate<? super A,? super B>> p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to true is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return false.true if any of predicates evaluate to true for given
values, false otherwise.public static <A,B,C> boolean isAny3(@Nullable A a, @Nullable B b, @Nullable C c, @Nullable GridPredicate3<? super A,? super B,? super C>... p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to true is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.C - Type of the 3d value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.c - 3d value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return false.true if any of predicates evaluate to true for given
values, false otherwise.public static <A,B,C> boolean isAny3(@Nullable A a, @Nullable B b, @Nullable C c, @Nullable Iterable<? extends GridPredicate3<? super A,? super B,? super C>> p)
true for given values. Note that
evaluation will be short-circuit when first predicate evaluated to true is found.A - Type of the 1st value for the predicates.B - Type of the 2nd value for the predicates.C - Type of the 3d value for the predicates.a - 1st value for predicate.b - 2nd value for predicate.c - 3d value for predicate.p - Optional set of predicates to use for evaluation. If no predicates provides
this method will always return false.true if any of predicates evaluate to true for given
values, false otherwise.public static <X,Y> Collection<Y> transform(Collection<? extends X> c, IgniteClosure<? super X,Y> f, IgnitePredicate<? super X>... p)
true for this value. Note that new collection will
be created.X - Type of the free variable for the closure and type of the collection elements.Y - Type of the closure's return value.c - Initial collection to transform.f - Closure to use for transformation.p - Optional set of predicate to use for transformation.public static GridAbsPredicate limit(int n)
true first n-times
it's called - and false thereafter.n - Number of calls this predicate will return true.true first n-times it's
called - and false thereafter.public static GridAbsClosure noop()
@Nullable public static <V> V find(Iterable<? extends V> c, @Nullable V dfltVal, @Nullable IgnitePredicate<? super V>... p)
true.V - Type of the collection elements.c - Input collection.dfltVal - Default value to return when no element is found.p - Optional set of finder predicates.true - or null if such element cannot be found.@Nullable public static <V> V find(V[] c, @Nullable V dfltVal, @Nullable IgnitePredicate<? super V>... p)
true.V - Type of the array elements.c - Input array.dfltVal - Default value to return when no element is found.p - Optional set of finder predicates.true - or null if such element cannot be found.public static <V,Y> Y find(Iterable<? extends V> c, @Nullable Y dfltVal, IgniteClosure<? super V,Y> f, @Nullable IgnitePredicate<? super V>... p)
true.V - Type of the collection elements.c - Input collection.dfltVal - Default value to return when no element is found.f - Transforming closure.p - Optional set of finder predicates.true - or null if such element cannot be found.public static <V,Y> Y find(V[] c,
@Nullable
Y dfltVal,
IgniteClosure<? super V,Y> f,
@Nullable
IgnitePredicate<? super V>... p)
true.V - Type of the array elements.c - Input array.dfltVal - Default value to return when no element is found.f - Transforming closure.p - Optional set of finder predicates.true - or null if such element cannot be found.public static <T> boolean containsAny(@Nullable Collection<? extends T> c1, @Nullable Iterable<? extends T> c2)
c1 contains any elements from collection c2.T - Type of the elements.c1 - Collection to check for containment. If null - this method returns false.c2 - Collection of elements to check. If null - this method returns false.true if collection c1 contains at least one element from collection
c2.public static <T> boolean containsAny(@Nullable Collection<? extends T> c1, @Nullable T... c2)
c1 contains any elements from array c2.T - Type of the elements.c1 - Collection to check for containment. If null - this method returns false.c2 - Collection of elements to check. If null - this method returns false.true if collection c1 contains at least one element from collection
c2.public static <T> boolean containsAll(@Nullable Collection<? extends T> c1, @Nullable Iterable<? extends T> c2)
c1 contains all elements from collection c2.T - Type of the elements.c1 - Collection to check for containment. If null - this method returns false.c2 - Collection of elements to check. If null - this method returns true
meaning that null-collection is treated as empty collection.true if collection c1 contains all elements from collection
c2.public static <T0,T extends T0> IgnitePair<Collection<T>> split(@Nullable Collection<T> c, @Nullable IgnitePredicate<? super T>... p)
T - Type of the collection.c - Collection to split. If null - pair of nulls will be returned.
If it's empty - pair of empty collections will be returned.p - Optional filter. All elements that satisfy all provided predicates
will go into 1st collection in pair. The rest will be in 2nd collection.
If not provided, pair of original and empty collection will be returned.public static <T> IgnitePair<T> pair(@Nullable T t1, @Nullable T t2)
T - Type of objects in pair.t1 - First object in pair.t2 - Second object in pair.public static <T> GridTriple<T> triple(@Nullable T t1, @Nullable T t2, @Nullable T t3)
T - Type of objects in triple.t1 - First object in triple.t2 - Second object in triple.t3 - Third object in triple.public static <V> IgniteBiTuple<Collection<V>,Collection<V>> partition(Iterable<? extends V> c, IgnitePredicate<? super V> p)
true - and second containing the elements for which
predicate evaluates to false.V - Type of the collection elements.c - Input collection.p - Partitioning predicate.true - and second containing the elements for which predicate
evaluates to false.public static <V> IgniteBiTuple<Collection<V>,Collection<V>> partition(V[] c, IgnitePredicate<? super V> p)
true - and second containing the elements for which predicate
evaluates to false.V - Type of the array elements.c - Input array.p - Partitioning predicate.true - and second containing the elements for which predicate
evaluates to false.public static <K,V> IgniteBiTuple<Map<K,V>,Map<K,V>> partition(Map<? extends K,? extends V> m, IgniteBiPredicate<? super K,? super V> p)
true - and second containing the entries for which predicate evaluates to false.K - Type of the map keys.V - Type of the map values.m - Input map.p - Partitioning predicate.true - and second containing the entries for which predicate evaluates to false.public static <V> boolean exist(Iterable<? extends V> c, @Nullable IgnitePredicate<? super V>... p)
true.V - Type of the collection elements.c - Input collection.p - Optional set of checking predicates.true if input collection contains element for which all the provided
predicates evaluates to true - otherwise returns false.public static <V> boolean exist(V[] c,
@Nullable
IgnitePredicate<? super V>... p)
true.V - Type of the array elements.c - Input array.p - Optional set of checking predicates.true if input array contains element for which all the provided predicates
valuates to true - otherwise returns false.public static <V> boolean forAll(Iterable<? extends V> c, @Nullable IgnitePredicate<? super V>... p)
true if all of them evaluate to true for all elements. Returns
false otherwise.V - Type of the collection element.c - Input collection.p - Optional set of checking predicates. If none provided - true is returned.true if all given predicates evaluate to true for
all elements. Returns false otherwise.public static <V> boolean forAll(V[] c,
@Nullable
IgnitePredicate<? super V>... p)
true
if all of them evaluate to true for all elements. Returns false otherwise.V - Type of the array element.c - Input array.p - Optional set of checking predicates.true if all given predicates evaluate to true for all elements.
Returns false otherwise.public static <K1,K extends K1,V1,V extends V1> boolean exist(Map<K,V> m, @Nullable IgnitePredicate<? super Map.Entry<K,V>>... p)
true.K - Type of the map keys.V - Type of the map values.m - Input map.p - Optional set of checking predicate.true if input map contains entry for which all provided predicates
evaluate to true - otherwise returns false.public static <K1,K extends K1,V1,V extends V1> boolean forAll(Map<K,V> m, @Nullable IgnitePredicate<? super Map.Entry<K,V>>... p)
true
if all of them evaluates to true for all entries. Returns false otherwise.K - Type of the map keys.V - Type of the map values.m - Input map.p - Optional set of checking predicate.true if all given predicate evaluates to true for all
entries. Returns false otherwise.public static <V> boolean forAny(Iterable<? extends V> c, @Nullable IgnitePredicate<? super V>... p)
true if all predicates evaluate to true for at least one element. Returns
false otherwise. Processing will short-circuit after first element evaluates to
true for all predicates.V - Type of the collection element.c - Input collection.p - Optional set of checking predicates. If none provided - true is returned.true if all given predicates evaluate to true for
at least one element. Returns false otherwise.public static <V> boolean forAny(V[] c,
@Nullable
IgnitePredicate<? super V>... p)
true
if all of them evaluate to true for at least one element. Returns false
otherwise. Processing will short-circuit after first element evaluates to
true for all predicates.V - Type of the array element.c - Input array.p - Optional set of checking predicates.true if all given predicates evaluate to true for at
least one element. Returns false otherwise.public static <K1,K extends K1,V1,V extends V1> boolean forAny(Map<K,V> m, @Nullable IgnitePredicate<? super Map.Entry<K,V>>... p)
true
if all of them evaluates to true for at least one entry. Returns false
otherwise. Processing will short-circuit after first entry evaluates to
true for all predicates.K - Type of the map keys.V - Type of the map values.m - Input map.p - Optional set of checking predicate.true if all given predicate evaluates to true for at
least one entry. Returns false otherwise.@Nullable public static <D,B> B fold(Iterable<? extends D> c, @Nullable B b, @Nullable IgniteBiClosure<? super D,? super B,B>... fs)
f(x) is the result of applying each closure from fs set to the
element x of the input collection c.
For example:
...
Collection<Integer> nums = new ArrayList<Integer>(size);
// Search max value.
Integer max = F.fold(nums, F.first(nums), new C2<Integer, Integer, Integer>() {
public Integer apply(Integer n, Integer max) { return Math.max(n, max); }
});
...
D - Type of the input collection elements and type of the free variable for the closure.B - Type of the folding value and return type of the closure.c - Input collection.b - Optional first folding pair element.fs - Optional set of folding closures.@Nullable public static <D,B> B fold(D[] c, @Nullable B b, @Nullable IgniteBiClosure<? super D,? super B,B>... fs)
f(x) is the result of applying each closure from fs set to
the element x of the input collection c.D - Type of the input array elements and type of the free variable for the closure.B - Type of the folding value and return type of the closure.c - Input array.b - Optional first folding pair element.fs - Optional set of folding closures.public static <V> GridTuple<V> t(@Nullable V v)
V - Type of the tuple.v - Parameter for tuple.public static <V> GridTuple<V> t1()
V - Type of the tuple.public static <V1,V2> IgniteBiTuple<V1,V2> t(@Nullable V1 v1, @Nullable V2 v2)
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.v1 - 1st parameter for tuple.v2 - 2nd parameter for tuple.public static <V1,V2> IgniteBiTuple<V1,V2> t2()
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.public static <V1,V2,V3> GridTuple3<V1,V2,V3> t(@Nullable V1 v1, @Nullable V2 v2, @Nullable V3 v3)
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.V3 - Type of the 3rd tuple parameter.v1 - 1st parameter for tuple.v2 - 2nd parameter for tuple.v3 - 3rd parameter for tuple.public static <V1,V2,V3,V4> GridTuple4<V1,V2,V3,V4> t(@Nullable V1 v1, @Nullable V2 v2, @Nullable V3 v3, @Nullable V4 v4)
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.V3 - Type of the 3rd tuple parameter.V4 - Type of the 4th tuple parameter.v1 - 1st parameter for tuple.v2 - 2nd parameter for tuple.v3 - 3rd parameter for tuple.v4 - 4th parameter for tuple.public static <V1,V2,V3,V4,V5> GridTuple5<V1,V2,V3,V4,V5> t(@Nullable V1 v1, @Nullable V2 v2, @Nullable V3 v3, @Nullable V4 v4, @Nullable V5 v5)
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.V3 - Type of the 3rd tuple parameter.V4 - Type of the 4th tuple parameter.V5 - Type of the 5th tuple parameter.v1 - 1st parameter for tuple.v2 - 2nd parameter for tuple.v3 - 3rd parameter for tuple.v4 - 4th parameter for tuple.v5 - 5th parameter for tuple.public static <V1,V2,V3,V4,V5,V6> GridTuple6<V1,V2,V3,V4,V5,V6> t(@Nullable V1 v1, @Nullable V2 v2, @Nullable V3 v3, @Nullable V4 v4, @Nullable V5 v5, @Nullable V6 v6)
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.V3 - Type of the 3rd tuple parameter.V4 - Type of the 4th tuple parameter.V5 - Type of the 5th tuple parameter.V6 - Type of the 6th tuple parameter.v1 - 1st parameter for tuple.v2 - 2nd parameter for tuple.v3 - 3rd parameter for tuple.v4 - 4th parameter for tuple.v5 - 5th parameter for tuple.v6 - 5th parameter for tuple.public static GridTupleV tv(Object... objs)
objs - Values for vararg tuple.public static <V1,V2,V3> GridTuple3<V1,V2,V3> t3()
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.V3 - Type of the 3rd tuple parameter.public static <V1,V2,V3,V4> GridTuple4<V1,V2,V3,V4> t4()
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.V3 - Type of the 3rd tuple parameter.V4 - Type of the 4th tuple parameter.public static <V1,V2,V3,V4,V5> GridTuple5<V1,V2,V3,V4,V5> t5()
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.V3 - Type of the 3rd tuple parameter.V4 - Type of the 4th tuple parameter.V5 - Type of the 5th tuple parameter.public static <V1,V2,V3,V4,V5,V6> GridTuple6<V1,V2,V3,V4,V5,V6> t6()
V1 - Type of the 1st tuple parameter.V2 - Type of the 2nd tuple parameter.V3 - Type of the 3rd tuple parameter.V4 - Type of the 4th tuple parameter.V5 - Type of the 5th tuple parameter.V6 - Type of the 6th tuple parameter.public static <K,V> Map<K,V> zip(Collection<? extends K> keys, V dfltVal)
K - Key type.V - Value type.keys - Map keys.dfltVal - Default value.public static <K,V> Map<K,V> zip(Collection<? extends K> keys, Collection<? extends V> vals)
K - Key type.V - Value type.keys - Map keys.vals - Map values.public static <K,V> Map<K,V> asMap(K k, V v)
K - Key's type.V - Value's type.k - Key.v - Value.public static <K,V> Map<K,V> asMap(K k1, V v1, K k2, V v2)
K - Key's type.V - Value's type.k1 - Key 1.v1 - Value 1.k2 - Key 2.v2 - Value 2.public static <K,V> Map<K,V> asMap(K k1, V v1, K k2, V v2, K k3, V v3)
K - Key's type.V - Value's type.k1 - Key 1.v1 - Value 1.k2 - Key 2.v2 - Value 2.k3 - Key 3.v3 - Value 3.public static <K,V> Map<K,V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
K - Key's type.V - Value's type.k1 - Key 1.v1 - Value 1.k2 - Key 2.v2 - Value 2.k3 - Key 3.v3 - Value 3.k4 - Key 4.v4 - Value 4.public static <K,V> Map<K,V> asMap(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5)
K - Key's type.V - Value's type.k1 - Key 1.v1 - Value 1.k2 - Key 2.v2 - Value 2.k3 - Key 3.v3 - Value 3.k4 - Key 4.v4 - Value 4.k5 - Key 5.v5 - Value 5.public static <T> T[] asArray(T... t)
T - Element type.t - Elements to convert into array.public static <T> List<T> asList(@Nullable T t)
T - Element's type.t - Element (if null, then empty list is returned).public static <T> Set<T> asSet(@Nullable T t)
T - Element's type.t - Element (if null, then empty set is returned).public static <T> Set<T> asSet(@Nullable T... t)
T - Element's type.t - Element (if null, then empty set is returned).public static <T> boolean contains(@Nullable Collection<T> c, @Nullable T t)
null, then false is returned.T - Value type.c - Collection to check.t - Value to check for containment.True if collection is not null and contains given
value, false otherwise.public static <T> IgnitePredicate<T> contains(@Nullable Collection<T> c)
true if it receives an element
that is contained in the passed in collection.T - Element type.c - Collection used for predicate filter.true if it receives an element
that is contained in the passed in collection.public static <T> IgnitePredicate<T> notContains(@Nullable Collection<T> c)
true if it receives an element
that is not contained in the passed in collection.T - Element type.c - Collection used for predicate filter.true if it receives an element
that is not contained in the passed in collection.public static boolean contains(int[] arr,
int val)
arr - Array.val - Value to find.True if array contains given value.public static boolean contains(long[] arr,
long val)
arr - Array.val - Value to find.True if array contains given value.public static boolean contains(Integer[] arr, Integer val)
arr - Array.val - Value to find.True if array contains given value.public static <K,V> IgnitePredicate<Map.Entry<K,V>> mapValue(@Nullable V val)
Map.Entry value and compares
its value to the given value.K - Map key type.V - Map value type.val - Value to compare entry's value.Map.Entry value and compares its value
to the given value.public static <K,V> IgnitePredicate<Map.Entry<K,V>> mapKey(@Nullable K key)
java.util.Map.Entry value and compares its key
to the given value.K - Map key type.V - Map value type.key - Value to compare entry's key.java.util.Map.Entry value and compares its key
to the given value.public static boolean eq(@Nullable Object o1, @Nullable Object o2)
null.o1 - Object to compare.o2 - Object to compare.true if the specified arguments are equal, or both null.public static boolean eqOrdered(@Nullable Collection<?> c1, @Nullable Collection<?> c2)
c1 - First collection.c2 - Second collection.True if both collections have equal elements in the same order.public static boolean eqNotOrdered(@Nullable Collection<?> c1, @Nullable Collection<?> c2)
Implementation of this method takes optimization steps based on the actual type
of the collections. Dups are allowed in the collection. Note that if collections
allow fixed-time random access (implementing RandomAccess marker interface
- having them pre-sorted dramatically improves the performance.
c1 - First collection.c2 - Second collection.True if both collections have equal elements in any order.public static <K,V> boolean eqNotOrdered(@Nullable Map<K,V> m1, @Nullable Map<K,V> m2)
java.util.AbstractMap#equals(...) method this implementation
checks not only entry sets, but also the keys. Some optimization checks are also used.m1 - First map to check.m2 - Second map to checkTrue is maps are equal, False otherwise.public static boolean eqArray(Object[] a1, Object[] a2, boolean sorted, boolean dups)
Arrays#equals(...) method this implementation
checks two arrays as sets allowing the same elements to be in different indexes.a1 - First array to check.a2 - Second array to check.sorted - Tells whether or not both arrays are pre-sorted so that binary
search could be used instead of iteration.dups - Tells whether or not arrays can contain duplicates. If arrays contain
duplicate the implementation will have to do double work.True if arrays are equal, false otherwise.public static boolean eqNodes(Object n1, Object n2)
ClusterNode instances for equality.
Since introduction of ClusterNode in Apache Ignite 3.0 the semantic of equality between
grid nodes has changed. Since rich node wraps thin node instance and in the same time
implements ClusterNode interface, the proper semantic of comparing two grid node is
to ignore their runtime types and compare only by their IDs. This method implements this logic.
End users rarely, if ever, need to directly compare two grid nodes for equality. This method is
intended primarily for discovery SPI developers that provide implementations of ClusterNode
interface.
n1 - Grid node 1.n2 - Grid node 2true if two grid node have the same IDs (ignoring their runtime types),
false otherwise.public static <T,R> Collection<IgniteOutClosure<R>> curry(Collection<? extends IgniteClosure<? super T,R>> iter, T arg)
T - Type of closure argument.R - Type of closure return value.iter - Collection to curry.arg - Argument to curry with.public static <T,R> Collection<IgniteOutClosure<R>> curry(Collection<? extends IgniteClosure<? super T,R>> closures, Collection<? extends T> args)
T - Type of closure argument.R - Type of closure return value.closures - Collection to curry.args - Collection of arguments to curry with.public static <T> Collection<GridAbsClosure> curry0(Collection<? extends IgniteInClosure<? super T>> in, Collection<? extends T> args)
curry methods.T - Type of closure argument.in - Collection to curry.args - Collection of arguments to curry with.public static <T,R> Collection<IgniteOutClosure<R>> curry(IgniteClosure<? super T,R> c, Collection<? extends T> args)
T - Type of closure argument.R - Type of closure return value.c - Closure to curry.args - Collection of arguments to curry with.public static <T,R> Collection<IgniteOutClosure<R>> curry(int cnt, IgniteClosure<? super T,R> c, IgniteOutClosure<T> pdc)
T - Type of closure argument.R - Type of closure return value.cnt - Number of closures to produce.c - Closure to curry.pdc - Producer of arguments to curry with.public static <T> Collection<GridAbsClosure> curry(IgniteInClosure<? super T> c, Collection<? extends T> args)
T - Type of closure argument.c - Closure to curry.args - Collection of arguments to curry with.public static <T> Collection<GridAbsClosure> curry(int cnt, IgniteInClosure<? super T> c, IgniteOutClosure<T> pdc)
T - Type of closure argument.cnt - Number of closures to produce.c - Closure to curry.pdc - Producer of arguments to curry with.public static <K> IgniteClosure<Map.Entry<K,?>,K> mapEntry2Key()
Map.Entry.getKey() method.K - Key type.public static <K,V> IgniteClosure<javax.cache.Cache.Entry<K,V>,K> cacheEntry2Key()
Cache.Entry.getKey() method.K - Key type.public static <V> IgniteClosure<Map.Entry<?,V>,V> mapEntry2Value()
Cache.Entry.getValue() method.V - Value type.public static <K,V> IgniteClosure<javax.cache.Cache.Entry<K,V>,V> cacheEntry2Get()
Cache.get(Object) method.K - Key type.V - Value type.public static <K,V> IgnitePredicate<javax.cache.Cache.Entry<K,V>> cacheHasKeys(@Nullable Collection<? extends K> keys)
true if entry's key is contained in given collection.
Note that if collection of provided keys is empty this method returns predicate that
evaluates to false when applying.K - Cache key type.V - Cache value type.keys - Keys to check.true if entry's key is contained in given collection.public static <K,V> IgnitePredicate<javax.cache.Cache.Entry<K,V>> cacheHasPeekValue()
true if entry has peek value.K - Cache key type.V - Cache value type.true if entry has peek value.public static IgnitePredicate<Event> eventNode(@Nullable String gridName, @Nullable IgnitePredicate<ClusterNode>... p)
true only if node that produced the event
satisfies all given predicates. Note that if array of provided node predicates is
null or empty this method returns predicate that evaluates to true
assuming that any event produced by any node is ok.gridName - Grid name.p - Node predicates.public static IgnitePredicate<Event> eventNode(@Nullable Collection<? extends ClusterNode> nodes)
true only if node that produced the event
is one of the given. Note that if array of provided nodes is null or empty
this method returns predicate that evaluates to false when applying.nodes - Nodes.public static GridClosureException wrap(Throwable e)
GridClosureException.e - Exception to wrap.GridClosureException.public static <E> boolean intersects(Iterable<E> s1, Collection<E>... s2)
E - Element type.s1 - Set1.s2 - Set2.True if there is an intersection, false otherwise.public static <T> void awaitAll(@Nullable IgniteInternalFuture<T>... futs) throws IgniteCheckedException
futs - Futures. If none provided - this method is no-op.IgniteCheckedException - If any of the futures failed.public static <T> void awaitAll(@Nullable Collection<IgniteInternalFuture<T>> futs) throws IgniteCheckedException
futs - Futures. If none provided - this method is no-op.IgniteCheckedException - If any of the futures failed.public static <T> void awaitAll(long timeout,
@Nullable
Collection<IgniteInternalFuture<T>> futs)
throws IgniteCheckedException
timeout - Timeout for waiting (0 for forever).futs - Futures. If none provided - this method is no-op.IgniteCheckedException - If any of the futures failed.@Nullable public static <T,R> R awaitAll(long timeout, @Nullable IgniteReducer<T,R> rdc, @Nullable Collection<IgniteInternalFuture<T>> futs) throws IgniteCheckedException
T - Return type of the futures.R - Return type of the reducer.timeout - Timeout for waiting (0 for forever).rdc - Optional reducer. If not null, then results will be reduced into one.futs - List of futures to wait for.null otherwise.IgniteCheckedException - If any of the futures failed.public static <T> IgniteInternalFuture<T> awaitOne(IgniteInternalFuture<T>... futs)
T - Type of computation result.futs - Futures. If none provided - this method return completed future
with null value.public static <T> IgniteInternalFuture<T> awaitOne(Iterable<IgniteInternalFuture<T>> futs)
T - Type of computation result.futs - Futures.public static IgnitePredicate<IgniteInternalFuture<?>> unfinishedFutures()
Follow @ApacheIgnite
Ignite Fabric : ver. 1.0.0 Release Date : March 31 2015