public class ContainerUtil extends ContainerUtilRt
Modifier and Type | Class and Description |
---|---|
static class |
ContainerUtil.ImmutableMapBuilder<K,V> |
static class |
ContainerUtil.KeyOrderedMultiMap<K extends java.lang.Comparable<? super K>,V> |
Constructor and Description |
---|
ContainerUtil() |
Modifier and Type | Method and Description |
---|---|
static <T> void |
add(T element,
java.util.Collection<? super T> result,
Disposable parentDisposable) |
static <T> void |
addAll(java.util.Collection<? super T> collection,
java.util.Collection<? extends T> elements)
Deprecated.
Use
Collection.addAll(Collection) instead |
static <T> void |
addAll(java.util.Collection<? super T> collection,
java.util.Enumeration<? extends T> enumeration) |
static <T> void |
addAll(java.util.Collection<? super T> collection,
java.lang.Iterable<? extends T> appendix) |
static <T> void |
addAll(java.util.Collection<? super T> collection,
java.util.Iterator<? extends T> iterator) |
static <T,C extends java.util.Collection<? super T>> |
addAll(C collection,
T... elements)
Add all supplied elements to the supplied collection and returns the modified collection.
|
static <T> void |
addAllNotNull(java.util.Collection<? super T> collection,
java.lang.Iterable<? extends T> elements)
Adds all not-null elements from the
elements , ignoring nulls |
static <T> void |
addAllNotNull(java.util.Collection<? super T> collection,
java.util.Iterator<? extends T> elements)
Adds all not-null elements from the
elements , ignoring nulls |
static <T,C extends java.util.Collection<T>> |
addAllNotNull(C collection,
T... elements)
Adds all not-null elements from the
elements , ignoring nulls |
static <T> void |
addIfNotNull(java.util.Collection<? super T> result,
T element) |
static <T> void |
addIfNotNull(T element,
java.util.Collection<? super T> result)
Deprecated.
use
addIfNotNull(Collection, Object) instead |
static <T> boolean |
all(java.util.Collection<? extends T> collection,
Condition<? super T> condition) |
static <T> boolean |
and(java.lang.Iterable<? extends T> iterable,
Condition<? super T> condition) |
static <T> boolean |
and(T [] iterable,
Condition<? super T> condition) |
static <T> java.util.List<T> |
append(java.util.List<? extends T> list,
T... values) |
static <T> T [] |
ar(T... elements) |
static <T> <any> |
canonicalStrategy() |
static <K,V> java.util.Map<K,java.util.Set<V>> |
classify(java.util.Iterator<? extends V> iterator,
Convertor<? super V,? extends K> keyConvertor) |
static <T> java.util.List<T> |
collect(java.util.Iterator<?> iterator,
FilteringIterator.InstanceOf<T> instanceOf) |
static <T> java.util.List<T> |
collect(java.util.Iterator<? extends T> iterator) |
static <T extends java.lang.Comparable<? super T>> |
compareLexicographically(java.util.List<? extends T> o1,
java.util.List<? extends T> o2) |
static <T> int |
compareLexicographically(java.util.List<? extends T> o1,
java.util.List<? extends T> o2,
java.util.Comparator<? super T> comparator) |
static <T> java.util.List<T> |
concat(java.lang.Iterable<? extends java.util.Collection<? extends T>> list) |
static <T> java.lang.Iterable<T> |
concat(java.lang.Iterable<? extends T>... iterables) |
static <T,V> java.util.List<V> |
concat(java.lang.Iterable<? extends T> list,
Function<? super T,? extends java.util.Collection<? extends V>> listGenerator) |
static <T> java.lang.Iterable<T> |
concat(java.lang.Iterable<? extends T> it1,
java.lang.Iterable<? extends T> it2) |
static <T> java.util.List<T> |
concat(java.util.List<? extends T>... lists) |
static <T> java.util.List<T> |
concat(java.util.List<? extends T> list1,
java.util.List<? extends T> list2) |
static <T> java.util.List<T> |
concat(java.util.List<java.util.List<? extends T>> lists) |
static <T> java.lang.Iterable<T> |
concat(T[]... iterables) |
static <T,V> java.util.List<T> |
concat(V [] array,
Function<? super V,? extends java.util.Collection<? extends T>> fun) |
static <T> java.util.Iterator<T> |
concatIterators(java.util.Collection<? extends java.util.Iterator<? extends T>> iterators) |
static <T> java.util.Iterator<T> |
concatIterators(java.util.Iterator<? extends T>... iterators) |
static <T> boolean |
containsIdentity(java.lang.Iterable<? extends T> list,
T element) |
static <K,V> V [] |
convert(K [] from,
V [] to,
Function<? super K,? extends V> fun) |
static <T> T [] |
copyAndClear(java.util.Collection<? extends T> collection,
ArrayFactory<? extends T> factory,
boolean clear) |
static <T> java.util.List<T> |
copyList(java.util.List<? extends T> list) |
static <T> int |
count(java.lang.Iterable<? extends T> iterable,
Condition<? super T> condition) |
static <V> ConcurrentIntObjectMap<V> |
createConcurrentIntObjectMap() |
static <V> ConcurrentIntObjectMap<V> |
createConcurrentIntObjectMap(int initialCapacity,
float loadFactor,
int concurrencyLevel) |
static <V> ConcurrentIntObjectMap<V> |
createConcurrentIntObjectSoftValueMap() |
static <V> ConcurrentIntObjectMap<V> |
createConcurrentIntObjectWeakValueMap() |
static <T> ConcurrentList<T> |
createConcurrentList() |
static <T> ConcurrentList<T> |
createConcurrentList(java.util.Collection<? extends T> collection) |
static <V> ConcurrentLongObjectMap<V> |
createConcurrentLongObjectMap() |
static <V> ConcurrentLongObjectMap<V> |
createConcurrentLongObjectMap(int initialCapacity) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentSoftKeySoftValueMap() |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentSoftKeySoftValueMap(int initialCapacity,
float loadFactor,
int concurrencyLevel,
<any> hashingStrategy) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentSoftMap() |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentSoftMap(int initialCapacity,
float loadFactor,
int concurrencyLevel,
<any> hashingStrategy) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentSoftValueMap() |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentWeakKeySoftValueMap() |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentWeakKeySoftValueMap(int initialCapacity,
float loadFactor,
int concurrencyLevel,
<any> hashingStrategy) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentWeakKeyWeakValueMap() |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentWeakKeyWeakValueMap(<any> strategy) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentWeakMap() |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentWeakMap(<any> hashingStrategy) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentWeakMap(int initialCapacity,
float loadFactor,
int concurrencyLevel,
<any> hashingStrategy) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
createConcurrentWeakValueMap() |
static <T> java.util.concurrent.CopyOnWriteArrayList<T> |
createEmptyCOWList() |
static <T> IntObjectMap<T> |
createIntKeyWeakValueMap() |
static <T> java.util.List<T> |
createLockFreeCopyOnWriteList()
Creates List which is thread-safe to modify and iterate.
|
static <T> java.util.List<T> |
createLockFreeCopyOnWriteList(java.util.Collection<? extends T> c) |
static <T> java.util.List<T> |
createMaybeSingletonList(T element) |
static <T> java.util.Set<T> |
createMaybeSingletonSet(T element) |
static <K,V> java.util.Map<K,V> |
createSoftKeySoftValueMap() |
static <K,V> java.util.Map<K,V> |
createSoftMap()
Soft keys hard values hash map.
|
static <K,V> java.util.Map<K,V> |
createSoftMap(<any> strategy) |
static <K,V> java.util.Map<K,V> |
createSoftValueMap()
Hard keys soft values hash map.
|
static <T> ObjectIntMap<T> |
createWeakKeyIntValueMap() |
static <K,V> java.util.Map<K,V> |
createWeakKeySoftValueMap() |
static <K,V> java.util.Map<K,V> |
createWeakKeyWeakValueMap() |
static <K,V> java.util.Map<K,V> |
createWeakMap()
Weak keys hard values hash map.
|
static <K,V> java.util.Map<K,V> |
createWeakMap(int initialCapacity) |
static <K,V> java.util.Map<K,V> |
createWeakMap(int initialCapacity,
float loadFactor,
<any> strategy) |
static <T> java.util.Set<T> |
createWeakSet() |
static <K,V> java.util.Map<K,V> |
createWeakValueMap()
Hard keys weak values hash map.
|
static <K,V> java.util.Map<K,Couple<V>> |
diff(java.util.Map<? extends K,? extends V> map1,
java.util.Map<? extends K,? extends V> map2) |
static <T> java.lang.Iterable<T> |
emptyIterable()
Deprecated.
Use
Collections.emptyList() instead |
static <T> java.util.Iterator<T> |
emptyIterator()
Deprecated.
Use
Collections.emptyIterator() instead |
static <T> java.util.List<T> |
emptyList() |
static <T> boolean |
equalsIdentity(java.util.List<? extends T> list1,
java.util.List<? extends T> list2) |
static <T> boolean |
exists(java.lang.Iterable<? extends T> iterable,
Condition<? super T> condition) |
static <T> boolean |
exists(T [] array,
Condition<? super T> condition) |
static <K,V> void |
fillMapWithValues(java.util.Map<? super K,? super V> map,
java.util.Iterator<? extends V> values,
Convertor<? super V,? extends K> keyConvertor) |
static <T> java.util.List<T> |
filter(java.util.Collection<? extends T> collection,
Condition<? super T> condition) |
static int [] |
filter(int [] collection,
TIntProcedure condition) |
static <K,V> java.util.Map<K,V> |
filter(java.util.Map<? extends K,? extends V> map,
Condition<? super K> keyFilter) |
static <T> java.util.List<T> |
filter(T [] collection,
Condition<? super T> condition) |
static <T> java.util.List<T> |
filterIsInstance(java.util.Collection<?> collection,
java.lang.Class<? extends T> aClass) |
static <T> java.util.Iterator<T> |
filterIterator(java.util.Iterator<? extends T> iterator,
Condition<? super T> filter) |
static <T> T |
find(java.lang.Iterable<? extends T> iterable,
Condition<? super T> condition) |
static <T> T |
find(java.lang.Iterable<? extends T> iterable,
T equalTo) |
static <T> T |
find(java.util.Iterator<? extends T> iterator,
Condition<? super T> condition) |
static <T> T |
find(java.util.Iterator<? extends T> iterator,
T equalTo) |
static <T> T |
find(T [] array,
Condition<? super T> condition) |
static <T,V> java.util.List<V> |
findAll(java.util.Collection<? extends T> collection,
java.lang.Class<V> instanceOf) |
static <T> java.util.List<T> |
findAll(java.util.Collection<? extends T> collection,
Condition<? super T> condition) |
static <T,V> java.util.List<V> |
findAll(T [] array,
java.lang.Class<V> instanceOf) |
static <T> java.util.List<T> |
findAll(T [] collection,
Condition<? super T> condition) |
static <T,V> V [] |
findAllAsArray(java.util.Collection<? extends T> collection,
java.lang.Class<V> instanceOf) |
static <T,V> V [] |
findAllAsArray(T [] collection,
java.lang.Class<V> instanceOf) |
static <T> T [] |
findAllAsArray(T [] collection,
Condition<? super T> instanceOf) |
static <T,U extends T> |
findInstance(java.lang.Iterable<? extends T> iterable,
java.lang.Class<? extends U> aClass) |
static <T,U extends T> |
findInstance(java.util.Iterator<? extends T> iterator,
java.lang.Class<? extends U> aClass) |
static <T,U extends T> |
findInstance(T [] array,
java.lang.Class<? extends U> aClass) |
static <T> T |
findLast(java.util.List<? extends T> list,
Condition<? super T> condition) |
static <T,U extends T> |
findLastInstance(java.util.List<? extends T> list,
java.lang.Class<? extends U> clazz) |
static <T,V> java.util.List<V> |
flatMap(java.lang.Iterable<? extends T> iterable,
Function<? super T,? extends java.util.List<V>> mapping) |
static <E> java.util.List<E> |
flatten(java.util.Collection<E> [] collections) |
static <E> java.util.List<E> |
flatten(java.lang.Iterable<? extends java.util.Collection<? extends E>> collections) |
static <E> java.util.List<E> |
flattenIterables(java.lang.Iterable<? extends java.lang.Iterable<? extends E>> collections) |
static <T> java.util.List<T> |
freeze(java.util.List<? extends T> list)
Create an immutable copy of the
list . |
static <T> T |
getFirstItem(java.util.Collection<? extends T> items) |
static <T> T |
getFirstItem(java.util.Collection<? extends T> items,
T defaultResult) |
static <T> T |
getFirstItem(java.util.List<? extends T> items) |
static <T> java.util.List<T> |
getFirstItems(java.util.List<T> items,
int maxItems)
The main difference from
subList is that getFirstItems does not
throw any exceptions, even if maxItems is greater than size of the list |
static <T> T |
getLastItem(java.util.List<? extends T> list) |
static <T> T |
getLastItem(java.util.List<? extends T> list,
T def) |
static <T> T |
getOnlyItem(java.util.Collection<? extends T> items)
Returns the only item from the collection or null if collection is empty or contains more than one item
|
static <T> T |
getOnlyItem(java.util.Collection<? extends T> items,
T defaultResult) |
static <T,V> V |
getOrCreate(java.util.Map<T,V> result,
T key,
Factory<? extends V> factory) |
static <T,V> V |
getOrCreate(java.util.Map<T,V> result,
T key,
V defaultValue) |
static <T> T |
getOrElse(java.util.List<? extends T> elements,
int i,
T defaultValue) |
static <T,V> V |
getOrElse(java.util.Map<? extends T,? extends V> map,
T key,
V defValue) |
static <K,V> MultiMap<K,V> |
groupBy(java.lang.Iterable<? extends V> collection,
NullableFunction<? super V,? extends K> grouper) |
static <T> <any> |
identityStrategy() |
static <E> ImmutableList<E> |
immutableList(E... array) |
static <E> ImmutableList<E> |
immutableList(java.util.List<? extends E> list) |
static <K,V> ContainerUtil.ImmutableMapBuilder<K,V> |
immutableMapBuilder() |
static <E> java.util.Set<E> |
immutableSet(E... elements) |
static <E> ImmutableList<E> |
immutableSingletonList(E element) |
static <T> int |
indexOf(java.util.List<? extends T> list,
Condition<? super T> condition) |
static <T> int |
indexOfIdentity(java.util.List<? extends T> list,
T element) |
static <T> java.util.Collection<T> |
intersection(java.util.Collection<? extends T> collection1,
java.util.Collection<? extends T> collection2) |
static <E extends java.lang.Enum<E>> |
intersection(java.util.EnumSet<E> collection1,
java.util.EnumSet<E> collection2) |
static <K,V> java.util.Map<K,V> |
intersection(java.util.Map<? extends K,? extends V> map1,
java.util.Map<? extends K,? extends V> map2) |
static <T> boolean |
intersects(java.util.Collection<? extends T> collection1,
java.util.Collection<? extends T> collection2) |
static <T> boolean |
isEmpty(java.util.Collection<? extends T> collection) |
static boolean |
isEmpty(java.util.Map<?,?> map) |
static <T> java.lang.Iterable<T> |
iterate(java.util.Collection<? extends T> collection,
Condition<? super T> condition) |
static <T> java.util.Iterator<T> |
iterate(java.util.Enumeration<? extends T> enumeration) |
static <T> java.util.Iterator<T> |
iterate(T [] array) |
static <T> java.lang.Iterable<T> |
iterate(T [] arrays,
Condition<? super T> condition) |
static <T> T |
iterateAndGetLastItem(java.lang.Iterable<? extends T> items) |
static <T> java.lang.Iterable<T> |
iterateBackward(java.util.List<? extends T> list) |
static <T> int |
lastIndexOf(java.util.List<? extends T> list,
Condition<? super T> condition) |
static <T,U extends T> |
lastIndexOfInstance(java.util.List<? extends T> list,
java.lang.Class<U> clazz) |
static <T> java.util.List<T> |
list(T... items)
Deprecated.
Use
Arrays.asList(Object[]) |
static <T,V> java.util.List<V> |
map(java.util.Collection<? extends T> collection,
Function<? super T,? extends V> mapping) |
static <T,V> java.util.List<V> |
map(java.lang.Iterable<? extends T> iterable,
Function<? super T,? extends V> mapping) |
static <T,V> java.util.List<V> |
map(T [] array,
Function<? super T,? extends V> mapping) |
static <T,V> V [] |
map(T [] arr,
Function<? super T,? extends V> mapping,
V [] emptyArray) |
static <T,V> V [] |
map2Array(java.util.Collection<? extends T> collection,
java.lang.Class<V> aClass,
Function<? super T,? extends V> mapper) |
static <T> java.lang.Object [] |
map2Array(java.util.Collection<? extends T> array,
Function<? super T,java.lang.Object> mapper) |
static <T,V> V [] |
map2Array(java.util.Collection<? extends T> collection,
V [] to,
Function<? super T,V> mapper) |
static <T,V> V [] |
map2Array(T [] array,
java.lang.Class<V> aClass,
Function<? super T,? extends V> mapper) |
static <T> java.lang.Object [] |
map2Array(T [] array,
Function<? super T,java.lang.Object> mapper) |
static <T,V> java.util.Set<V> |
map2LinkedSet(java.util.Collection<? extends T> collection,
Function<? super T,? extends V> mapper) |
static <T,V> java.util.List<V> |
map2List(java.util.Collection<? extends T> collection,
Function<? super T,? extends V> mapper) |
static <K,V> java.util.List<Pair<K,V>> |
map2List(java.util.Map<? extends K,? extends V> map) |
static <T,V> java.util.List<V> |
map2List(T [] array,
Function<? super T,? extends V> mapper) |
static <K,V> java.util.Map<K,V> |
map2Map(java.util.Collection<? extends Pair<? extends K,? extends V>> collection) |
static <T,K,V> java.util.Map<K,V> |
map2Map(java.util.Collection<? extends T> collection,
Function<? super T,? extends Pair<K,V>> mapper) |
static <T,K,V> java.util.Map<K,V> |
map2Map(T [] collection,
Function<? super T,? extends Pair<K,V>> mapper) |
static <T,K,V> java.util.Map<K,V> |
map2MapNotNull(java.util.Collection<? extends T> collection,
Function<? super T,? extends Pair<K,V>> mapper) |
static <T,K,V> java.util.Map<K,V> |
map2MapNotNull(T [] collection,
Function<? super T,? extends Pair<K,V>> mapper) |
static <T,V> java.util.Set<V> |
map2Set(java.util.Collection<? extends T> collection,
Function<? super T,? extends V> mapper) |
static <T,V> java.util.Set<V> |
map2Set(T [] array,
Function<? super T,? extends V> mapper) |
static <T,V> java.util.Set<V> |
map2SetNotNull(java.util.Collection<? extends T> collection,
Function<? super T,? extends V> mapper) |
static <T,U> java.util.Iterator<U> |
mapIterator(java.util.Iterator<? extends T> iterator,
Function<? super T,? extends U> mapper) |
static <U> java.util.Iterator<U> |
mapIterator(TIntIterator iterator,
java.util.function.IntFunction<? extends U> mapper) |
static <T,V> java.util.List<V> |
mapNotNull(java.util.Collection<? extends T> collection,
Function<? super T,? extends V> mapping) |
static <T,V> java.util.List<V> |
mapNotNull(java.lang.Iterable<? extends T> iterable,
Function<? super T,? extends V> mapping) |
static <T,V> java.util.List<V> |
mapNotNull(T [] array,
Function<? super T,? extends V> mapping) |
static <T,V> V [] |
mapNotNull(T [] array,
Function<? super T,? extends V> mapping,
V [] emptyArray) |
static <T> T [] |
mergeCollectionsToArray(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2,
ArrayFactory<? extends T> factory) |
static <T> java.util.List<T> |
mergeSortedLists(java.util.List<? extends T> list1,
java.util.List<? extends T> list2,
java.util.Comparator<? super T> comparator,
boolean mergeEqualItems) |
static <T> java.util.ArrayList<T> |
newArrayList()
Deprecated.
Use
ArrayList() |
static <E> java.util.ArrayList<E> |
newArrayList(java.util.Collection<? extends E> iterable)
Deprecated.
Use
ArrayList(Collection) instead |
static <E> java.util.ArrayList<E> |
newArrayList(E... array) |
static <E> java.util.ArrayList<E> |
newArrayList(java.lang.Iterable<? extends E> iterable) |
static <T> java.util.List<T> |
newArrayList(T [] elements,
int start,
int end) |
static <T> java.util.ArrayList<T> |
newArrayListWithCapacity(int size)
Deprecated.
Use
ArrayList(int) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
newConcurrentMap() |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
newConcurrentMap(int initialCapacity) |
static <K,V> java.util.concurrent.ConcurrentMap<K,V> |
newConcurrentMap(int initialCapacity,
float loadFactor,
int concurrencyLevel) |
static <T> java.util.Set<T> |
newConcurrentSet() |
static <K extends java.lang.Enum<K>,V> |
newEnumMap(java.lang.Class<K> keyType)
Deprecated.
Use
EnumMap(Class) |
static <K,V> java.util.HashMap<K,V> |
newHashMap()
Deprecated.
Use
HashMap() |
static <K,V> java.util.Map<K,V> |
newHashMap(java.util.List<? extends K> keys,
java.util.List<? extends V> values) |
static <K,V> java.util.HashMap<K,V> |
newHashMap(java.util.Map<? extends K,? extends V> map)
Deprecated.
Use
HashMap(Map) |
static <K,V> java.util.Map<K,V> |
newHashMap(Pair<? extends K,? extends V> first,
Pair<? extends K,? extends V>... entries) |
static <T> java.util.Set<T> |
newHashOrEmptySet(java.lang.Iterable<? extends T> iterable) |
static <T> java.util.HashSet<T> |
newHashSet()
Deprecated.
Use
HashSet() |
static <T> java.util.HashSet<T> |
newHashSet(java.util.Collection<? extends T> collection)
Deprecated.
|
static <T> java.util.HashSet<T> |
newHashSet(int initialCapacity)
Deprecated.
Use
HashSet(int) |
static <T> java.util.HashSet<T> |
newHashSet(java.lang.Iterable<? extends T> iterable) |
static <T> java.util.HashSet<T> |
newHashSet(java.util.Iterator<? extends T> iterator) |
static <T> java.util.HashSet<T> |
newHashSet(T... elements) |
static <K,V> java.util.IdentityHashMap<K,V> |
newIdentityHashMap() |
static <K,V> <any> |
newIdentityTroveMap() |
static <K> <any> |
newIdentityTroveSet() |
static <K> <any> |
newIdentityTroveSet(java.util.Collection<? extends K> collection) |
static <K> <any> |
newIdentityTroveSet(int initialCapacity) |
static <K,V> java.util.LinkedHashMap<K,V> |
newLinkedHashMap()
Deprecated.
Use
LinkedHashMap() |
static <K,V> java.util.LinkedHashMap<K,V> |
newLinkedHashMap(java.util.Map<? extends K,? extends V> map)
Deprecated.
Use
LinkedHashMap(Map) |
static <K,V> java.util.LinkedHashMap<K,V> |
newLinkedHashMap(Pair<? extends K,? extends V> first,
Pair<? extends K,? extends V>... entries) |
static <T> java.util.LinkedHashSet<T> |
newLinkedHashSet()
Deprecated.
Use
LinkedHashSet() |
static <T> java.util.LinkedHashSet<T> |
newLinkedHashSet(java.util.Collection<? extends T> elements)
Deprecated.
Use
LinkedHashSet(Collection) instead |
static <T> java.util.LinkedHashSet<T> |
newLinkedHashSet(java.lang.Iterable<? extends T> elements) |
static <T> java.util.LinkedHashSet<T> |
newLinkedHashSet(T... elements) |
static <T> java.util.LinkedList<T> |
newLinkedList()
Deprecated.
Use
LinkedList() |
static <T> java.util.LinkedList<T> |
newLinkedList(T... elements) |
static <K,V> java.util.Map<K,V> |
newMapFromKeys(java.util.Iterator<? extends K> keys,
Convertor<? super K,? extends V> valueConvertor) |
static <K,V> java.util.Map<K,V> |
newMapFromValues(java.util.Iterator<? extends V> values,
Convertor<? super V,? extends K> keyConvertor) |
static <T> java.util.List<T> |
newSmartList()
Deprecated.
Use
SmartList() |
static <T> java.util.List<T> |
newSmartList(T... elements)
Deprecated.
Use
SmartList(T) |
static <T> java.util.List<T> |
newSmartList(T element)
Deprecated.
Use
SmartList(T) |
static <T> Stack<T> |
newStack()
Deprecated.
Use
Stack() |
static <K extends java.lang.Comparable<? super K>,V> |
newTreeMap()
Deprecated.
Use
TreeMap() |
static <K extends java.lang.Comparable<? super K>,V> |
newTreeMap(java.util.Map<? extends K,? extends V> map)
Deprecated.
Use
TreeMap(Map) |
static <T extends java.lang.Comparable<? super T>> |
newTreeSet()
Deprecated.
Use
TreeSet() |
static <T> java.util.TreeSet<T> |
newTreeSet(java.util.Comparator<? super T> comparator)
Deprecated.
Use
TreeSet(Comparator) |
static <K,V> <any> |
newTroveMap()
Deprecated.
Use
THashMap#THashMap(Map) |
static <K,V> <any> |
newTroveMap(<any> strategy)
Deprecated.
Use
THashMap#THashMap(TObjectHashingStrategy) |
static <T> <any> |
newTroveSet()
Deprecated.
Use
THashSet#THashSet() |
static <T> <any> |
newTroveSet(<any> strategy)
Deprecated.
Use
THashSet#THashSet(TObjectHashingStrategy) |
static <T> <any> |
newTroveSet(<any> strategy,
java.util.Collection<? extends T> elements) |
static <T> <any> |
newTroveSet(<any> strategy,
T... elements) |
static <T> <any> |
newTroveSet(java.util.Collection<? extends T> elements)
Deprecated.
Use
THashSet#THashSet(Collection) |
static <T> <any> |
newTroveSet(T... elements) |
static <T> java.util.List<T> |
newUnmodifiableList(java.util.List<? extends T> originalList) |
static <T> java.util.List<T> |
notNullize(java.util.List<T> list) |
static <K,V> java.util.Map<K,V> |
notNullize(java.util.Map<K,V> map) |
static <T> java.util.Set<T> |
notNullize(java.util.Set<T> set) |
static <T,C extends java.util.Collection<? extends T>> |
nullize(C collection) |
static <T> boolean |
or(java.lang.Iterable<? extends T> iterable,
Condition<? super T> condition) |
static <T> boolean |
or(T [] iterable,
Condition<? super T> condition) |
static <T> java.util.List<T> |
packNullables(T... elements) |
static <T> java.util.List<T> |
prepend(java.util.List<? extends T> list,
T... values)
prepend values in front of the list
|
static <T> boolean |
process(java.lang.Iterable<? extends T> iterable,
Processor<? super T> processor) |
static <T> boolean |
process(java.util.Iterator<? extends T> iterator,
Processor<? super T> processor) |
static <T> boolean |
process(java.util.List<? extends T> list,
Processor<? super T> processor) |
static <T> boolean |
process(T [] iterable,
Processor<? super T> processor) |
static <T> void |
processSortedListsInOrder(java.util.List<? extends T> list1,
java.util.List<? extends T> list2,
java.util.Comparator<? super T> comparator,
boolean mergeEqualItems,
Consumer<? super T> processor) |
static <K,V> void |
putIfAbsent(K key,
V value,
java.util.Map<? super K,? super V> result) |
static <K,V> void |
putIfNotNull(K key,
java.util.Collection<? extends V> value,
MultiMap<? super K,? super V> result) |
static <K,V> void |
putIfNotNull(K key,
V value,
java.util.Map<? super K,? super V> result) |
static <K,V> void |
putIfNotNull(K key,
V value,
MultiMap<? super K,? super V> result) |
static <T> void |
quickSort(java.util.List<? extends T> list,
java.util.Comparator<? super T> comparator) |
static <T> boolean |
removeAll(java.util.Collection<T> collection,
T... elements) |
static <T> void |
removeDuplicates(java.util.Collection<T> collection) |
static <T> java.util.List<T> |
removeDuplicatesFromSorted(java.util.List<T> list,
java.util.Comparator<? super T> comparator)
Processes the list, remove all duplicates and return the list with unique elements.
|
static <T> boolean |
retainAll(java.util.Collection<T> collection,
Condition<? super T> condition) |
static <E> java.util.List<E> |
reverse(java.util.List<? extends E> elements) |
static <A,B> java.util.Map<B,A> |
reverseMap(java.util.Map<? extends A,? extends B> map) |
static <T> java.util.Set<T> |
set(T... items) |
static <T> java.util.Set<T> |
singleton(T o,
<any> strategy) |
static <T> java.util.List<T> |
skipNulls(java.util.Collection<? extends T> collection) |
static <T extends java.lang.Comparable<? super T>> |
sort(java.util.List<T> list) |
static <T> void |
sort(java.util.List<T> list,
java.util.Comparator<? super T> comparator) |
static <T extends java.lang.Comparable<? super T>> |
sort(T [] a) |
static <T> void |
sort(T [] a,
java.util.Comparator<? super T> comparator) |
static <T extends java.lang.Comparable<? super T>> |
sorted(java.util.Collection<? extends T> list) |
static <T> java.util.List<T> |
sorted(java.util.Collection<? extends T> list,
java.util.Comparator<? super T> comparator) |
static <T> java.util.List<T> |
sorted(java.lang.Iterable<? extends T> list,
java.util.Comparator<? super T> comparator) |
static <T> boolean |
startsWith(java.util.List<? extends T> list,
java.util.List<? extends T> prefix) |
static java.util.Map<java.lang.String,java.lang.String> |
stringMap(java.lang.String... keyValues) |
static <T> java.util.List<T> |
subList(java.util.List<T> list,
int from) |
static <T> java.util.Collection<T> |
subtract(java.util.Collection<? extends T> from,
java.util.Collection<? extends T> what) |
static <E> void |
swapElements(java.util.List<E> list,
int index1,
int index2) |
static <T> T [] |
toArray(java.util.Collection<? extends T> c1,
java.util.Collection<? extends T> c2,
ArrayFactory<? extends T> factory) |
static <T> T [] |
toArray(java.util.Collection<? extends T> c,
T [] sample)
Deprecated.
use
Collection.toArray(Object[]) instead |
static <T> T [] |
toArray(java.util.Collection<T> c,
ArrayFactory<? extends T> factory) |
static <T> T [] |
toArray(java.util.List<T> collection,
T [] array)
Deprecated.
use
List.toArray(Object[]) instead |
static <T> java.util.Collection<T> |
toCollection(java.lang.Iterable<? extends T> iterable) |
static <T> java.util.List<T> |
toList(java.util.Enumeration<? extends T> enumeration) |
static java.lang.String |
toString(java.util.Map<?,?> map)
Returns a String representation of the given map, by listing all key-value pairs contained in the map.
|
static <T> java.util.List<T> |
trimToSize(java.util.List<T> list) |
static <T> java.util.Set<T> |
union(java.util.Collection<? extends T> set,
java.util.Collection<? extends T> set2) |
static <K,V> java.util.Map<K,V> |
union(java.util.Map<? extends K,? extends V> map,
java.util.Map<? extends K,? extends V> map2) |
static <T> java.util.Set<T> |
union(java.util.Set<? extends T> set,
java.util.Set<? extends T> set2) |
static <T> java.util.Collection<T> |
unmodifiableOrEmptyCollection(java.util.Collection<? extends T> original) |
static <T> java.util.List<T> |
unmodifiableOrEmptyList(java.util.List<? extends T> original) |
static <K,V> java.util.Map<K,V> |
unmodifiableOrEmptyMap(java.util.Map<? extends K,? extends V> original) |
static <T> java.util.Set<T> |
unmodifiableOrEmptySet(java.util.Set<? extends T> original) |
static <T,E> java.lang.Iterable<Pair<T,E>> |
zip(java.lang.Iterable<? extends T> iterable1,
java.lang.Iterable<? extends E> iterable2) |
newArrayList, newArrayList, newArrayList, newHashMap, newHashSet, newLinkedHashSet, newLinkedList, newLinkedList, putValue
@SafeVarargs public static <T> T [] ar(T... elements)
@Deprecated public static <K,V> java.util.HashMap<K,V> newHashMap()
HashMap()
@Deprecated public static <K,V> java.util.HashMap<K,V> newHashMap(java.util.Map<? extends K,? extends V> map)
HashMap(Map)
@SafeVarargs public static <K,V> java.util.Map<K,V> newHashMap(Pair<? extends K,? extends V> first, Pair<? extends K,? extends V>... entries)
public static <K,V> java.util.Map<K,V> newHashMap(java.util.List<? extends K> keys, java.util.List<? extends V> values)
@Deprecated public static <K extends java.lang.Comparable<? super K>,V> java.util.TreeMap<K,V> newTreeMap()
TreeMap()
@Deprecated public static <K extends java.lang.Comparable<? super K>,V> java.util.TreeMap<K,V> newTreeMap(java.util.Map<? extends K,? extends V> map)
TreeMap(Map)
@Deprecated public static <K,V> java.util.LinkedHashMap<K,V> newLinkedHashMap()
LinkedHashMap()
@Deprecated public static <K,V> java.util.LinkedHashMap<K,V> newLinkedHashMap(java.util.Map<? extends K,? extends V> map)
LinkedHashMap(Map)
@SafeVarargs public static <K,V> java.util.LinkedHashMap<K,V> newLinkedHashMap(Pair<? extends K,? extends V> first, Pair<? extends K,? extends V>... entries)
@Deprecated public static <K,V> <any> newTroveMap()
THashMap#THashMap(Map)
@Deprecated public static <K,V> <any> newTroveMap(<any> strategy)
THashMap#THashMap(TObjectHashingStrategy)
@Deprecated public static <K extends java.lang.Enum<K>,V> java.util.EnumMap<K,V> newEnumMap(java.lang.Class<K> keyType)
EnumMap(Class)
public static <T> <any> canonicalStrategy()
public static <T> <any> identityStrategy()
public static <K,V> java.util.IdentityHashMap<K,V> newIdentityHashMap()
@Deprecated public static <T> java.util.LinkedList<T> newLinkedList()
LinkedList()
@SafeVarargs public static <T> java.util.LinkedList<T> newLinkedList(T... elements)
@Deprecated public static <T> java.util.ArrayList<T> newArrayList()
ArrayList()
@SafeVarargs public static <E> java.util.ArrayList<E> newArrayList(E... array)
@Deprecated public static <E> java.util.ArrayList<E> newArrayList(java.util.Collection<? extends E> iterable)
ArrayList(Collection)
insteadpublic static <E> java.util.ArrayList<E> newArrayList(java.lang.Iterable<? extends E> iterable)
@Deprecated public static <T> java.util.ArrayList<T> newArrayListWithCapacity(int size)
ArrayList(int)
public static <T> java.util.List<T> newArrayList(T [] elements, int start, int end)
public static <T> java.util.List<T> newUnmodifiableList(java.util.List<? extends T> originalList)
public static <T> java.util.Collection<T> unmodifiableOrEmptyCollection(java.util.Collection<? extends T> original)
public static <T> java.util.List<T> unmodifiableOrEmptyList(java.util.List<? extends T> original)
public static <T> java.util.Set<T> unmodifiableOrEmptySet(java.util.Set<? extends T> original)
public static <K,V> java.util.Map<K,V> unmodifiableOrEmptyMap(java.util.Map<? extends K,? extends V> original)
@Deprecated public static <T> java.util.List<T> newSmartList()
SmartList()
@Deprecated public static <T> java.util.List<T> newSmartList(T element)
SmartList(T)
@SafeVarargs @Deprecated public static <T> java.util.List<T> newSmartList(T... elements)
SmartList(T)
@Deprecated public static <T> java.util.HashSet<T> newHashSet()
HashSet()
@Deprecated public static <T> java.util.HashSet<T> newHashSet(int initialCapacity)
HashSet(int)
@SafeVarargs public static <T> java.util.HashSet<T> newHashSet(T... elements)
public static <T> java.util.HashSet<T> newHashSet(java.lang.Iterable<? extends T> iterable)
@Deprecated public static <T> java.util.HashSet<T> newHashSet(java.util.Collection<? extends T> collection)
HashSet(Collection)
public static <T> java.util.HashSet<T> newHashSet(java.util.Iterator<? extends T> iterator)
public static <T> java.util.Set<T> newHashOrEmptySet(java.lang.Iterable<? extends T> iterable)
@Deprecated public static <T> java.util.LinkedHashSet<T> newLinkedHashSet()
LinkedHashSet()
public static <T> java.util.LinkedHashSet<T> newLinkedHashSet(java.lang.Iterable<? extends T> elements)
@Deprecated public static <T> java.util.LinkedHashSet<T> newLinkedHashSet(java.util.Collection<? extends T> elements)
LinkedHashSet(Collection)
instead@SafeVarargs public static <T> java.util.LinkedHashSet<T> newLinkedHashSet(T... elements)
@Deprecated public static <T> <any> newTroveSet()
THashSet#THashSet()
@Deprecated public static <T> <any> newTroveSet(<any> strategy)
THashSet#THashSet(TObjectHashingStrategy)
@SafeVarargs public static <T> <any> newTroveSet(T... elements)
@SafeVarargs public static <T> <any> newTroveSet(<any> strategy, T... elements)
public static <T> <any> newTroveSet(<any> strategy, java.util.Collection<? extends T> elements)
@Deprecated public static <T> <any> newTroveSet(java.util.Collection<? extends T> elements)
THashSet#THashSet(Collection)
public static <K> <any> newIdentityTroveSet()
public static <K> <any> newIdentityTroveSet(int initialCapacity)
public static <K> <any> newIdentityTroveSet(java.util.Collection<? extends K> collection)
public static <K,V> <any> newIdentityTroveMap()
@Deprecated public static <T extends java.lang.Comparable<? super T>> java.util.TreeSet<T> newTreeSet()
TreeSet()
@Deprecated public static <T> java.util.TreeSet<T> newTreeSet(java.util.Comparator<? super T> comparator)
TreeSet(Comparator)
public static <T> java.util.Set<T> newConcurrentSet()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> newConcurrentMap()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> newConcurrentMap(int initialCapacity)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> newConcurrentMap(int initialCapacity, float loadFactor, int concurrencyLevel)
public static <E> java.util.List<E> reverse(java.util.List<? extends E> elements)
public static <K,V> java.util.Map<K,V> union(java.util.Map<? extends K,? extends V> map, java.util.Map<? extends K,? extends V> map2)
public static <T> java.util.Set<T> union(java.util.Set<? extends T> set, java.util.Set<? extends T> set2)
public static <T> java.util.Set<T> union(java.util.Collection<? extends T> set, java.util.Collection<? extends T> set2)
@SafeVarargs public static <E> java.util.Set<E> immutableSet(E... elements)
@SafeVarargs public static <E> ImmutableList<E> immutableList(E... array)
public static <E> ImmutableList<E> immutableSingletonList(E element)
public static <E> ImmutableList<E> immutableList(java.util.List<? extends E> list)
public static <K,V> ContainerUtil.ImmutableMapBuilder<K,V> immutableMapBuilder()
public static <K,V> MultiMap<K,V> groupBy(java.lang.Iterable<? extends V> collection, NullableFunction<? super V,? extends K> grouper)
public static <T> T getOrElse(java.util.List<? extends T> elements, int i, T defaultValue)
public static <U> java.util.Iterator<U> mapIterator(TIntIterator iterator, java.util.function.IntFunction<? extends U> mapper)
public static <K,V> java.util.Map<K,V> intersection(java.util.Map<? extends K,? extends V> map1, java.util.Map<? extends K,? extends V> map2)
public static <K,V> java.util.Map<K,Couple<V>> diff(java.util.Map<? extends K,? extends V> map1, java.util.Map<? extends K,? extends V> map2)
public static <T> void processSortedListsInOrder(java.util.List<? extends T> list1, java.util.List<? extends T> list2, java.util.Comparator<? super T> comparator, boolean mergeEqualItems, Consumer<? super T> processor)
public static <T> java.util.List<T> mergeSortedLists(java.util.List<? extends T> list1, java.util.List<? extends T> list2, java.util.Comparator<? super T> comparator, boolean mergeEqualItems)
public static <T> java.util.List<T> subList(java.util.List<T> list, int from)
@Deprecated public static <T> void addAll(java.util.Collection<? super T> collection, java.util.Collection<? extends T> elements)
Collection.addAll(Collection)
insteadpublic static <T> void addAll(java.util.Collection<? super T> collection, java.lang.Iterable<? extends T> appendix)
public static <T> void addAll(java.util.Collection<? super T> collection, java.util.Iterator<? extends T> iterator)
public static <T> void addAllNotNull(java.util.Collection<? super T> collection, java.lang.Iterable<? extends T> elements)
elements
, ignoring nullspublic static <T> void addAllNotNull(java.util.Collection<? super T> collection, java.util.Iterator<? extends T> elements)
elements
, ignoring nullspublic static <T> java.util.List<T> collect(java.util.Iterator<? extends T> iterator)
public static <K,V> java.util.Map<K,V> newMapFromKeys(java.util.Iterator<? extends K> keys, Convertor<? super K,? extends V> valueConvertor)
public static <K,V> java.util.Map<K,V> newMapFromValues(java.util.Iterator<? extends V> values, Convertor<? super V,? extends K> keyConvertor)
public static <K,V> void fillMapWithValues(java.util.Map<? super K,? super V> map, java.util.Iterator<? extends V> values, Convertor<? super V,? extends K> keyConvertor)
public static <K,V> java.util.Map<K,java.util.Set<V>> classify(java.util.Iterator<? extends V> iterator, Convertor<? super V,? extends K> keyConvertor)
@Deprecated public static <T> java.util.Iterator<T> emptyIterator()
Collections.emptyIterator()
instead@Deprecated public static <T> java.lang.Iterable<T> emptyIterable()
Collections.emptyList()
insteadpublic static <T> T find(T [] array, Condition<? super T> condition)
public static <T> boolean process(java.lang.Iterable<? extends T> iterable, Processor<? super T> processor)
public static <T> boolean process(java.util.List<? extends T> list, Processor<? super T> processor)
public static <T> boolean process(T [] iterable, Processor<? super T> processor)
public static <T> boolean process(java.util.Iterator<? extends T> iterator, Processor<? super T> processor)
public static <T> T find(java.lang.Iterable<? extends T> iterable, Condition<? super T> condition)
public static <T> T find(java.lang.Iterable<? extends T> iterable, T equalTo)
public static <T> T find(java.util.Iterator<? extends T> iterator, T equalTo)
public static <T> T find(java.util.Iterator<? extends T> iterator, Condition<? super T> condition)
public static <T> T findLast(java.util.List<? extends T> list, Condition<? super T> condition)
public static <T,K,V> java.util.Map<K,V> map2Map(T [] collection, Function<? super T,? extends Pair<K,V>> mapper)
public static <T,K,V> java.util.Map<K,V> map2Map(java.util.Collection<? extends T> collection, Function<? super T,? extends Pair<K,V>> mapper)
public static <T,K,V> java.util.Map<K,V> map2MapNotNull(T [] collection, Function<? super T,? extends Pair<K,V>> mapper)
public static <T,K,V> java.util.Map<K,V> map2MapNotNull(java.util.Collection<? extends T> collection, Function<? super T,? extends Pair<K,V>> mapper)
public static <K,V> java.util.Map<K,V> map2Map(java.util.Collection<? extends Pair<? extends K,? extends V>> collection)
public static <T> java.lang.Object [] map2Array(T [] array, Function<? super T,java.lang.Object> mapper)
public static <T> java.lang.Object [] map2Array(java.util.Collection<? extends T> array, Function<? super T,java.lang.Object> mapper)
public static <T,V> V [] map2Array(T [] array, java.lang.Class<V> aClass, Function<? super T,? extends V> mapper)
public static <T,V> V [] map2Array(java.util.Collection<? extends T> collection, java.lang.Class<V> aClass, Function<? super T,? extends V> mapper)
public static <T,V> V [] map2Array(java.util.Collection<? extends T> collection, V [] to, Function<? super T,V> mapper)
public static <T> java.util.List<T> filter(T [] collection, Condition<? super T> condition)
public static int [] filter(int [] collection, TIntProcedure condition)
public static <T> java.util.List<T> findAll(T [] collection, Condition<? super T> condition)
public static <T> java.util.List<T> filterIsInstance(java.util.Collection<?> collection, java.lang.Class<? extends T> aClass)
public static <T> java.util.List<T> filter(java.util.Collection<? extends T> collection, Condition<? super T> condition)
public static <K,V> java.util.Map<K,V> filter(java.util.Map<? extends K,? extends V> map, Condition<? super K> keyFilter)
public static <T> java.util.List<T> findAll(java.util.Collection<? extends T> collection, Condition<? super T> condition)
public static <T> java.util.List<T> skipNulls(java.util.Collection<? extends T> collection)
public static <T,V> java.util.List<V> findAll(T [] array, java.lang.Class<V> instanceOf)
public static <T,V> V [] findAllAsArray(T [] collection, java.lang.Class<V> instanceOf)
public static <T,V> V [] findAllAsArray(java.util.Collection<? extends T> collection, java.lang.Class<V> instanceOf)
public static <T> T [] findAllAsArray(T [] collection, Condition<? super T> instanceOf)
public static <T,V> java.util.List<V> findAll(java.util.Collection<? extends T> collection, java.lang.Class<V> instanceOf)
public static <T> boolean all(java.util.Collection<? extends T> collection, Condition<? super T> condition)
public static <T> void removeDuplicates(java.util.Collection<T> collection)
public static java.util.Map<java.lang.String,java.lang.String> stringMap(java.lang.String... keyValues)
public static <T> java.util.Iterator<T> iterate(T [] array)
public static <T> java.util.Iterator<T> iterate(java.util.Enumeration<? extends T> enumeration)
public static <T> java.lang.Iterable<T> iterate(T [] arrays, Condition<? super T> condition)
public static <T> java.lang.Iterable<T> iterate(java.util.Collection<? extends T> collection, Condition<? super T> condition)
public static <T> java.lang.Iterable<T> iterateBackward(java.util.List<? extends T> list)
public static <T,E> java.lang.Iterable<Pair<T,E>> zip(java.lang.Iterable<? extends T> iterable1, java.lang.Iterable<? extends E> iterable2)
public static <E> void swapElements(java.util.List<E> list, int index1, int index2)
public static <T> java.util.List<T> collect(java.util.Iterator<?> iterator, FilteringIterator.InstanceOf<T> instanceOf)
public static <T> void addAll(java.util.Collection<? super T> collection, java.util.Enumeration<? extends T> enumeration)
@SafeVarargs public static <T,C extends java.util.Collection<? super T>> C addAll(C collection, T... elements)
Collections.addAll(Collection, Object[])
this method does not track whether collection
was modified, so it could be marginally faster.T
- type of collection elementsC
- type of the collectioncollection
- collection to add elements toelements
- elements to add@SafeVarargs public static <T,C extends java.util.Collection<T>> C addAllNotNull(C collection, T... elements)
elements
, ignoring nulls@SafeVarargs public static <T> boolean removeAll(java.util.Collection<T> collection, T... elements)
public static <T> boolean retainAll(java.util.Collection<T> collection, Condition<? super T> condition)
public static <T,U extends T> U findInstance(java.lang.Iterable<? extends T> iterable, java.lang.Class<? extends U> aClass)
public static <T,U extends T> U findInstance(java.util.Iterator<? extends T> iterator, java.lang.Class<? extends U> aClass)
public static <T,U extends T> U findInstance(T [] array, java.lang.Class<? extends U> aClass)
public static <T,V> java.util.List<T> concat(V [] array, Function<? super V,? extends java.util.Collection<? extends T>> fun)
public static <T> java.util.List<T> concat(java.lang.Iterable<? extends java.util.Collection<? extends T>> list)
@SafeVarargs public static <T> java.util.List<T> append(java.util.List<? extends T> list, T... values)
@SafeVarargs public static <T> java.util.List<T> prepend(java.util.List<? extends T> list, T... values)
public static <T> java.util.List<T> concat(java.util.List<? extends T> list1, java.util.List<? extends T> list2)
public static <T> java.lang.Iterable<T> concat(java.lang.Iterable<? extends T> it1, java.lang.Iterable<? extends T> it2)
@SafeVarargs public static <T> java.lang.Iterable<T> concat(java.lang.Iterable<? extends T>... iterables)
@SafeVarargs public static <T> java.util.Iterator<T> concatIterators(java.util.Iterator<? extends T>... iterators)
public static <T> java.util.Iterator<T> concatIterators(java.util.Collection<? extends java.util.Iterator<? extends T>> iterators)
@SafeVarargs public static <T> java.lang.Iterable<T> concat(T[]... iterables)
@SafeVarargs public static <T> java.util.List<T> concat(java.util.List<? extends T>... lists)
public static <T> java.util.List<T> concat(java.util.List<java.util.List<? extends T>> lists)
public static <T,V> java.util.List<V> concat(java.lang.Iterable<? extends T> list, Function<? super T,? extends java.util.Collection<? extends V>> listGenerator)
public static <T> boolean intersects(java.util.Collection<? extends T> collection1, java.util.Collection<? extends T> collection2)
public static <T> java.util.Collection<T> intersection(java.util.Collection<? extends T> collection1, java.util.Collection<? extends T> collection2)
public static <E extends java.lang.Enum<E>> java.util.EnumSet<E> intersection(java.util.EnumSet<E> collection1, java.util.EnumSet<E> collection2)
public static <T> T getFirstItem(java.util.Collection<? extends T> items)
public static <T> T getFirstItem(java.util.List<? extends T> items)
public static <T> T getFirstItem(java.util.Collection<? extends T> items, T defaultResult)
public static <T> T getOnlyItem(java.util.Collection<? extends T> items)
T
- type of collection elementitems
- collection to get the item frompublic static <T> T getOnlyItem(java.util.Collection<? extends T> items, T defaultResult)
public static <T> java.util.List<T> getFirstItems(java.util.List<T> items, int maxItems)
subList
is that getFirstItems
does not
throw any exceptions, even if maxItems is greater than size of the listT
- type of listitems
- listmaxItems
- size of the result will be equal or less than maxItems
maxItems
first elementspublic static <T> T iterateAndGetLastItem(java.lang.Iterable<? extends T> items)
public static <T,U> java.util.Iterator<U> mapIterator(java.util.Iterator<? extends T> iterator, Function<? super T,? extends U> mapper)
public static <T> java.util.Iterator<T> filterIterator(java.util.Iterator<? extends T> iterator, Condition<? super T> filter)
public static <T> T getLastItem(java.util.List<? extends T> list, T def)
public static <T> T getLastItem(java.util.List<? extends T> list)
public static <T> java.util.Collection<T> subtract(java.util.Collection<? extends T> from, java.util.Collection<? extends T> what)
public static <T> T [] toArray(java.util.Collection<T> c, ArrayFactory<? extends T> factory)
public static <T> T [] toArray(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2, ArrayFactory<? extends T> factory)
public static <T> T [] mergeCollectionsToArray(java.util.Collection<? extends T> c1, java.util.Collection<? extends T> c2, ArrayFactory<? extends T> factory)
public static <T extends java.lang.Comparable<? super T>> void sort(java.util.List<T> list)
public static <T> void sort(java.util.List<T> list, java.util.Comparator<? super T> comparator)
public static <T extends java.lang.Comparable<? super T>> void sort(T [] a)
public static <T> java.util.List<T> sorted(java.util.Collection<? extends T> list, java.util.Comparator<? super T> comparator)
public static <T> java.util.List<T> sorted(java.lang.Iterable<? extends T> list, java.util.Comparator<? super T> comparator)
public static <T extends java.lang.Comparable<? super T>> java.util.List<T> sorted(java.util.Collection<? extends T> list)
public static <T> void sort(T [] a, java.util.Comparator<? super T> comparator)
public static <T,V> java.util.List<V> map(java.lang.Iterable<? extends T> iterable, Function<? super T,? extends V> mapping)
iterable
- an input iterable to processmapping
- a side-effect free function which transforms iterable elementspublic static <T,V> java.util.List<V> map(java.util.Collection<? extends T> collection, Function<? super T,? extends V> mapping)
collection
- an input collection to processmapping
- a side-effect free function which transforms iterable elementspublic static <T,V> java.util.List<V> mapNotNull(T [] array, Function<? super T,? extends V> mapping)
array
- an input array to processmapping
- a side-effect free function which transforms array elementspublic static <T,V> V [] mapNotNull(T [] array, Function<? super T,? extends V> mapping, V [] emptyArray)
array
- an input array to processmapping
- a side-effect free function which transforms array elementsemptyArray
- an empty array of desired result type (may be returned if the result is also empty)public static <T,V> java.util.List<V> mapNotNull(java.lang.Iterable<? extends T> iterable, Function<? super T,? extends V> mapping)
iterable
- an input iterable to processmapping
- a side-effect free function which transforms iterable elementspublic static <T,V> java.util.List<V> mapNotNull(java.util.Collection<? extends T> collection, Function<? super T,? extends V> mapping)
collection
- an input collection to processmapping
- a side-effect free function which transforms collection elements@SafeVarargs public static <T> java.util.List<T> packNullables(T... elements)
public static <T,V> java.util.List<V> map(T [] array, Function<? super T,? extends V> mapping)
public static <T,V> V [] map(T [] arr, Function<? super T,? extends V> mapping, V [] emptyArray)
@SafeVarargs public static <T> java.util.Set<T> set(T... items)
public static <K,V> void putIfAbsent(K key, V value, java.util.Map<? super K,? super V> result)
public static <K,V> void putIfNotNull(K key, V value, java.util.Map<? super K,? super V> result)
public static <K,V> void putIfNotNull(K key, java.util.Collection<? extends V> value, MultiMap<? super K,? super V> result)
public static <K,V> void putIfNotNull(K key, V value, MultiMap<? super K,? super V> result)
public static <T> void add(T element, java.util.Collection<? super T> result, Disposable parentDisposable)
public static <T> java.util.List<T> createMaybeSingletonList(T element)
public static <T> java.util.Set<T> createMaybeSingletonSet(T element)
public static <T,V> V getOrCreate(java.util.Map<T,V> result, T key, V defaultValue)
public static <T,V> V getOrCreate(java.util.Map<T,V> result, T key, Factory<? extends V> factory)
public static <T,V> V getOrElse(java.util.Map<? extends T,? extends V> map, T key, V defValue)
public static <T> boolean and(T [] iterable, Condition<? super T> condition)
public static <T> boolean and(java.lang.Iterable<? extends T> iterable, Condition<? super T> condition)
public static <T> boolean exists(T [] array, Condition<? super T> condition)
public static <T> boolean exists(java.lang.Iterable<? extends T> iterable, Condition<? super T> condition)
public static <T> boolean or(T [] iterable, Condition<? super T> condition)
public static <T> boolean or(java.lang.Iterable<? extends T> iterable, Condition<? super T> condition)
public static <T> int count(java.lang.Iterable<? extends T> iterable, Condition<? super T> condition)
@SafeVarargs @Deprecated public static <T> java.util.List<T> list(T... items)
Arrays.asList(Object[])
public static <T> void quickSort(java.util.List<? extends T> list, java.util.Comparator<? super T> comparator)
public static <T> java.util.Set<T> singleton(T o, <any> strategy)
public static <E> java.util.List<E> flatten(java.util.Collection<E> [] collections)
public static <T> java.util.List<T> removeDuplicatesFromSorted(java.util.List<T> list, java.util.Comparator<? super T> comparator)
list
- must be sorted (according to the comparator), all elements must be not-nullpublic static <E> java.util.List<E> flatten(java.lang.Iterable<? extends java.util.Collection<? extends E>> collections)
public static <E> java.util.List<E> flattenIterables(java.lang.Iterable<? extends java.lang.Iterable<? extends E>> collections)
public static <T,V> java.util.List<V> flatMap(java.lang.Iterable<? extends T> iterable, Function<? super T,? extends java.util.List<V>> mapping)
public static <K,V> V [] convert(K [] from, V [] to, Function<? super K,? extends V> fun)
public static <T> boolean containsIdentity(java.lang.Iterable<? extends T> list, T element)
public static <T> int indexOfIdentity(java.util.List<? extends T> list, T element)
public static <T> boolean equalsIdentity(java.util.List<? extends T> list1, java.util.List<? extends T> list2)
public static <T> int indexOf(java.util.List<? extends T> list, Condition<? super T> condition)
public static <T> int lastIndexOf(java.util.List<? extends T> list, Condition<? super T> condition)
public static <T,U extends T> U findLastInstance(java.util.List<? extends T> list, java.lang.Class<? extends U> clazz)
public static <T,U extends T> int lastIndexOfInstance(java.util.List<? extends T> list, java.lang.Class<U> clazz)
public static <A,B> java.util.Map<B,A> reverseMap(java.util.Map<? extends A,? extends B> map)
public static <T> java.util.List<T> trimToSize(java.util.List<T> list)
public static <T> java.util.List<T> emptyList()
public static <T> java.util.concurrent.CopyOnWriteArrayList<T> createEmptyCOWList()
public static <T> java.util.List<T> createLockFreeCopyOnWriteList()
list.toArray(new T[list.size()])
on this list because it is inherently racey and
therefore can return array with null elements at the end.public static <T> java.util.List<T> createLockFreeCopyOnWriteList(java.util.Collection<? extends T> c)
public static <V> ConcurrentIntObjectMap<V> createConcurrentIntObjectMap()
public static <V> ConcurrentIntObjectMap<V> createConcurrentIntObjectMap(int initialCapacity, float loadFactor, int concurrencyLevel)
public static <V> ConcurrentIntObjectMap<V> createConcurrentIntObjectSoftValueMap()
public static <V> ConcurrentLongObjectMap<V> createConcurrentLongObjectMap()
public static <V> ConcurrentLongObjectMap<V> createConcurrentLongObjectMap(int initialCapacity)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentWeakValueMap()
public static <V> ConcurrentIntObjectMap<V> createConcurrentIntObjectWeakValueMap()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentWeakKeySoftValueMap(int initialCapacity, float loadFactor, int concurrencyLevel, <any> hashingStrategy)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentSoftKeySoftValueMap()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentSoftKeySoftValueMap(int initialCapacity, float loadFactor, int concurrencyLevel, <any> hashingStrategy)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentWeakKeySoftValueMap()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentWeakKeyWeakValueMap()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentWeakKeyWeakValueMap(<any> strategy)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentSoftValueMap()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentSoftMap()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentWeakMap()
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentSoftMap(int initialCapacity, float loadFactor, int concurrencyLevel, <any> hashingStrategy)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentWeakMap(int initialCapacity, float loadFactor, int concurrencyLevel, <any> hashingStrategy)
public static <K,V> java.util.concurrent.ConcurrentMap<K,V> createConcurrentWeakMap(<any> hashingStrategy)
public static <T> ConcurrentList<T> createConcurrentList()
createLockFreeCopyOnWriteList()
public static <T> ConcurrentList<T> createConcurrentList(java.util.Collection<? extends T> collection)
@Deprecated public static <T> void addIfNotNull(T element, java.util.Collection<? super T> result)
addIfNotNull(Collection, Object)
insteadpublic static <T> void addIfNotNull(java.util.Collection<? super T> result, T element)
public static <T,V> java.util.List<V> map2List(T [] array, Function<? super T,? extends V> mapper)
public static <T,V> java.util.List<V> map2List(java.util.Collection<? extends T> collection, Function<? super T,? extends V> mapper)
public static <K,V> java.util.List<Pair<K,V>> map2List(java.util.Map<? extends K,? extends V> map)
public static <T,V> java.util.Set<V> map2Set(T [] array, Function<? super T,? extends V> mapper)
public static <T,V> java.util.Set<V> map2Set(java.util.Collection<? extends T> collection, Function<? super T,? extends V> mapper)
public static <T,V> java.util.Set<V> map2LinkedSet(java.util.Collection<? extends T> collection, Function<? super T,? extends V> mapper)
public static <T,V> java.util.Set<V> map2SetNotNull(java.util.Collection<? extends T> collection, Function<? super T,? extends V> mapper)
@Deprecated public static <T> T [] toArray(java.util.List<T> collection, T [] array)
List.toArray(Object[])
instead@Deprecated public static <T> T [] toArray(java.util.Collection<? extends T> c, T [] sample)
Collection.toArray(Object[])
insteadpublic static <T> T [] copyAndClear(java.util.Collection<? extends T> collection, ArrayFactory<? extends T> factory, boolean clear)
public static <T> java.util.List<T> copyList(java.util.List<? extends T> list)
public static <T> java.util.Collection<T> toCollection(java.lang.Iterable<? extends T> iterable)
public static <T> java.util.List<T> toList(java.util.Enumeration<? extends T> enumeration)
public static <T> boolean isEmpty(java.util.Collection<? extends T> collection)
public static boolean isEmpty(java.util.Map<?,?> map)
public static <T> java.util.List<T> notNullize(java.util.List<T> list)
public static <T> java.util.Set<T> notNullize(java.util.Set<T> set)
public static <K,V> java.util.Map<K,V> notNullize(java.util.Map<K,V> map)
public static <T> boolean startsWith(java.util.List<? extends T> list, java.util.List<? extends T> prefix)
public static <T,C extends java.util.Collection<? extends T>> C nullize(C collection)
public static <T extends java.lang.Comparable<? super T>> int compareLexicographically(java.util.List<? extends T> o1, java.util.List<? extends T> o2)
public static <T> int compareLexicographically(java.util.List<? extends T> o1, java.util.List<? extends T> o2, java.util.Comparator<? super T> comparator)
public static java.lang.String toString(java.util.Map<?,?> map)
public static <K,V> java.util.Map<K,V> createWeakKeySoftValueMap()
public static <K,V> java.util.Map<K,V> createWeakKeyWeakValueMap()
public static <K,V> java.util.Map<K,V> createSoftKeySoftValueMap()
public static <K,V> java.util.Map<K,V> createSoftValueMap()
public static <K,V> java.util.Map<K,V> createWeakValueMap()
public static <K,V> java.util.Map<K,V> createSoftMap()
public static <K,V> java.util.Map<K,V> createSoftMap(<any> strategy)
public static <K,V> java.util.Map<K,V> createWeakMap()
public static <K,V> java.util.Map<K,V> createWeakMap(int initialCapacity)
public static <K,V> java.util.Map<K,V> createWeakMap(int initialCapacity, float loadFactor, <any> strategy)
public static <T> java.util.Set<T> createWeakSet()
public static <T> IntObjectMap<T> createIntKeyWeakValueMap()
public static <T> ObjectIntMap<T> createWeakKeyIntValueMap()
public static <T> java.util.List<T> freeze(java.util.List<? extends T> list)
list
.
Modifications of the list
have no effect on the returned copy.