public class CollectionUtils extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
CollectionUtils.DualTransformer<L,R>
dual transform type between L and R
CollectionUtils.DualTransformer.toRight(Object) L -> RCollectionUtils.DualTransformer.fromRight(Object) R -> L |
static interface |
CollectionUtils.Function<F,T> |
Modifier and Type | Method and Description |
---|---|
static <L,R> CollectionUtils.DualTransformer<L,R> |
asDualTransformer(CollectionUtils.Function<L,R> t1,
CollectionUtils.Function<R,L> t2) |
static <L,R> CollectionUtils.Function<R,L> |
asFromRightTransformer(CollectionUtils.DualTransformer<L,R> dual) |
static <L,R> CollectionUtils.Function<L,R> |
asToRightTransformer(CollectionUtils.DualTransformer<L,R> dual) |
static <T> T |
checkNotNull(T reference)
Ensures that an object reference passed as a parameter to the calling method is not null.
|
static <T> T |
checkNotNull(T reference,
java.lang.Object errorMessage)
Ensures that an object reference passed as a parameter to the calling method is not null.
|
static <C extends java.util.Collection<?>> |
checkNotNullElement(C c)
Ensures that a collection reference passed as a parameter to the calling method not exists null element if it's not null.
|
static <K1,K2,V> java.util.Map<K2,V> |
tranformKeys(java.util.Map<K1,V> fromMap,
CollectionUtils.DualTransformer<K1,K2> transformer)
Returns a view of a map where each value is transformed by a function.
|
static <K1,K2,V> java.util.Map<K2,V> |
tranformKeys(java.util.Map<K1,V> fromMap,
CollectionUtils.Function<K1,K2> transformer2,
CollectionUtils.Function<K2,K1> transformer1) |
static <F,T> java.util.Iterator<T> |
transform(java.util.Iterator<F> fromIterator,
CollectionUtils.Function<? super F,? extends T> transformer)
Returns an iterator that applies
function to each element of fromIterator .see also Iterators.transform(Iterator, com.google.common.base.Function) |
static <E1,E2> java.util.Set<E2> |
transform(java.util.Set<E1> fromSet,
CollectionUtils.DualTransformer<E1,E2> transformer)
Returns a view of a set where each key is transformed by a function.
|
static <E1,E2> java.util.Set<E2> |
transform(java.util.Set<E1> fromSet,
CollectionUtils.Function<E1,E2> transformer2,
CollectionUtils.Function<E2,E1> transformer1) |
public static final <L,R> CollectionUtils.DualTransformer<L,R> asDualTransformer(CollectionUtils.Function<L,R> t1, CollectionUtils.Function<R,L> t2)
public static final <L,R> CollectionUtils.Function<L,R> asToRightTransformer(CollectionUtils.DualTransformer<L,R> dual)
public static final <L,R> CollectionUtils.Function<R,L> asFromRightTransformer(CollectionUtils.DualTransformer<L,R> dual)
public static <T> T checkNotNull(T reference)
public static <T> T checkNotNull(T reference, java.lang.Object errorMessage)
public static <C extends java.util.Collection<?>> C checkNotNullElement(C c)
public static final <K1,K2,V> java.util.Map<K2,V> tranformKeys(java.util.Map<K1,V> fromMap, CollectionUtils.Function<K1,K2> transformer2, CollectionUtils.Function<K2,K1> transformer1)
tranformKeys(Map, DualTransformer)
public static final <K1,K2,V> java.util.Map<K2,V> tranformKeys(java.util.Map<K1,V> fromMap, CollectionUtils.DualTransformer<K1,K2> transformer)
Maps.transformEntries(Map, com.google.common.collect.Maps.EntryTransformer)
fromMap
- transformer
- public static final <E1,E2> java.util.Set<E2> transform(java.util.Set<E1> fromSet, CollectionUtils.Function<E1,E2> transformer2, CollectionUtils.Function<E2,E1> transformer1)
transform(Set, DualTransformer)
public static final <E1,E2> java.util.Set<E2> transform(java.util.Set<E1> fromSet, CollectionUtils.DualTransformer<E1,E2> transformer)
Maps.transformEntries(Map, com.google.common.collect.Maps.EntryTransformer)
fromSet
- transformer
- public static <F,T> java.util.Iterator<T> transform(java.util.Iterator<F> fromIterator, CollectionUtils.Function<? super F,? extends T> transformer)
function
to each element of fromIterator
.Iterators.transform(Iterator, com.google.common.base.Function)
fromIterator
- transformer
- Copyright © 2019. All rights reserved.