public final class CollectionUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_COLLECTION_CAPACITY |
static float |
DEFAULT_LOAD_FACTOR |
static float |
DEFAULT_MIN_LOAD |
Modifier and Type | Method and Description |
---|---|
static java.util.Map<java.lang.Object,java.lang.Object> |
asLinkedMap(java.lang.Object... items) |
static <T> java.util.List<T> |
asList(T... items) |
static java.util.Map<java.lang.Object,java.lang.Object> |
asMap(java.lang.Object... items) |
static <T> java.util.Set<T> |
asSet(T... items) |
static <T extends java.lang.Comparable<? super T>> |
asSortedList(java.util.Collection<T> items) |
static <T> java.util.List<T> |
asSortedList(java.util.Collection<T> items,
java.util.Comparator<? super T> comparator) |
static <T> java.util.Stack<T> |
asStack(T... items) |
static <T> boolean |
contains(java.lang.Iterable<T> iterable,
T target) |
static <T> boolean |
contains(T[] array,
T target) |
static int |
count(boolean[] a,
boolean value) |
static <E> boolean |
equals(java.util.Collection<E> c1,
java.util.Collection<E> c2) |
static boolean |
equals(java.util.Map<?,?> map,
java.lang.Object key,
java.lang.Object value)
Checks whether the given
key is mapped to an object equal
to the value parameter. |
static <K,V> boolean |
equals(java.util.Map<K,V> m1,
java.util.Map<K,V> m2) |
static boolean |
equals(java.lang.Object o1,
java.lang.Object o2) |
static <T> void |
feedItems(java.util.Collection<T> collection,
T... items) |
static void |
feedItems(gnu.trove.TLongCollection collection,
long... items) |
static void |
fillAscending(int[] a) |
static void |
fillAscending(java.lang.Integer[] a) |
static <T> java.util.Collection<T> |
filter(java.util.Collection<T> col,
Filter filter) |
static <K,V> V |
firstSet(java.util.Map<K,V> map,
K... keys) |
static boolean |
firstSetBoolean(java.util.Map<java.lang.String,java.lang.String> map,
boolean defaultValue,
java.lang.String... keys) |
static double |
firstSetDouble(java.util.Map<java.lang.String,java.lang.String> map,
double defaultValue,
java.lang.String... keys) |
static float |
firstSetFloat(java.util.Map<java.lang.String,java.lang.String> map,
float defaultValue,
java.lang.String... keys) |
static int |
firstSetInt(java.util.Map<java.lang.String,java.lang.String> map,
int defaultValue,
java.lang.String... keys) |
static long |
firstSetLong(java.util.Map<java.lang.String,java.lang.String> map,
long defaultValue,
java.lang.String... keys) |
static java.lang.String |
firstSetString(java.util.Map<java.lang.String,java.lang.String> map,
java.lang.String defaultValue,
java.lang.String... keys) |
static <V> V |
get(java.util.Map<?,V> map,
java.lang.Object key) |
static <E> java.util.Collection<E> |
getCollectionProxy(java.util.Collection<E> collection) |
static <E> java.util.List<E> |
getListProxy(java.util.List<E> list) |
static <K,V> java.util.Map<K,V> |
getMapProxy(java.util.Map<K,V> map) |
static <E> java.util.Set<E> |
getSetProxy(java.util.Set<E> set) |
static int |
hashCode(int[] source) |
static int |
hashCode(java.lang.Iterable<? extends java.lang.Object> source) |
static <T> int |
indexOf(T[] array,
T target) |
static boolean |
isAscending(int[] a) |
static boolean |
isTrue(java.util.Map<?,?> map,
java.lang.Object key)
Tests whether a specific key maps to some value that represents
the boolean value
true either directly by being of type
boolean or in textual form such that a call to
Boolean.parseBoolean(String) returns true . |
static boolean |
isUniform(java.lang.Iterable<?> list) |
static boolean |
isUniform(java.lang.Object[] list) |
static int |
max(int... values) |
static int |
min(int... values) |
static void |
permutate(int[] a,
int[] permutation) |
static <T> void |
permutate(T[] a,
int[] permutation) |
static void |
reverse(int[] array,
int offset,
int length) |
static void |
reverse(java.lang.Object[] array,
int offset,
int length) |
static java.lang.String |
toString(java.util.Collection<?> collection) |
static java.lang.String |
toString(java.util.Collection<?> collection,
char delimiter) |
static java.lang.String |
toString(java.util.Map map) |
static <T> java.util.Collection<T> |
unmodifiableCollectionProxy(java.util.Collection<? extends T> c) |
static <T> java.util.List<T> |
unmodifiableListProxy(java.util.List<? extends T> list) |
static <K,V> java.util.Map<K,V> |
unmodifiableMapProxy(java.util.Map<? extends K,? extends V> m)
Returns an unmodifiable view of the specified map.
|
static <T> java.util.Set<T> |
unmodifiableSetProxy(java.util.Set<? extends T> s) |
static <T> java.util.SortedSet<T> |
unmodifiableSortedSetProxy(java.util.SortedSet<T> s)
Returns an unmodifiable view of the specified sorted set.
|
public static final int DEFAULT_COLLECTION_CAPACITY
public static final float DEFAULT_LOAD_FACTOR
public static final float DEFAULT_MIN_LOAD
public static <E> java.util.Set<E> getSetProxy(java.util.Set<E> set)
public static <E> java.util.Collection<E> getCollectionProxy(java.util.Collection<E> collection)
public static <E> java.util.List<E> getListProxy(java.util.List<E> list)
public static <K,V> java.util.Map<K,V> getMapProxy(java.util.Map<K,V> map)
public static boolean equals(java.lang.Object o1, java.lang.Object o2)
public static boolean isTrue(java.util.Map<?,?> map, java.lang.Object key)
true
either directly by being of type
boolean
or in textual form such that a call to
Boolean.parseBoolean(String)
returns true
.
If the map
argument is null
then the return value
is false
;public static boolean equals(java.util.Map<?,?> map, java.lang.Object key, java.lang.Object value)
key
is mapped to an object equal
to the value
parameter. If the map
argument is
null
then the return value is true
in case that
the value
parameter is null
and false
in any
other case.public static <V> V get(java.util.Map<?,V> map, java.lang.Object key)
public static <T> java.util.Collection<T> filter(java.util.Collection<T> col, Filter filter)
public static <T> boolean contains(java.lang.Iterable<T> iterable, T target)
public static <T> boolean contains(T[] array, T target)
public static <T> int indexOf(T[] array, T target)
@SafeVarargs public static <T> void feedItems(java.util.Collection<T> collection, T... items)
public static void feedItems(gnu.trove.TLongCollection collection, long... items)
@SafeVarargs public static <T> java.util.Set<T> asSet(T... items)
@SafeVarargs public static <T> java.util.List<T> asList(T... items)
@SafeVarargs public static <T> java.util.Stack<T> asStack(T... items)
public static java.util.Map<java.lang.Object,java.lang.Object> asMap(java.lang.Object... items)
public static java.util.Map<java.lang.Object,java.lang.Object> asLinkedMap(java.lang.Object... items)
public static <T extends java.lang.Comparable<? super T>> java.util.List<T> asSortedList(java.util.Collection<T> items)
public static <T> java.util.List<T> asSortedList(java.util.Collection<T> items, java.util.Comparator<? super T> comparator)
public static int min(int... values)
public static int max(int... values)
public static void fillAscending(int[] a)
public static void fillAscending(java.lang.Integer[] a)
public static boolean isAscending(int[] a)
public static void permutate(int[] a, int[] permutation)
public static <T> void permutate(T[] a, int[] permutation)
public static void reverse(int[] array, int offset, int length)
public static int count(boolean[] a, boolean value)
public static void reverse(java.lang.Object[] array, int offset, int length)
public static boolean isUniform(java.lang.Iterable<?> list)
public static boolean isUniform(java.lang.Object[] list)
@SafeVarargs public static <K,V> V firstSet(java.util.Map<K,V> map, K... keys)
public static java.lang.String firstSetString(java.util.Map<java.lang.String,java.lang.String> map, java.lang.String defaultValue, java.lang.String... keys)
public static int firstSetInt(java.util.Map<java.lang.String,java.lang.String> map, int defaultValue, java.lang.String... keys)
public static long firstSetLong(java.util.Map<java.lang.String,java.lang.String> map, long defaultValue, java.lang.String... keys)
public static float firstSetFloat(java.util.Map<java.lang.String,java.lang.String> map, float defaultValue, java.lang.String... keys)
public static double firstSetDouble(java.util.Map<java.lang.String,java.lang.String> map, double defaultValue, java.lang.String... keys)
public static boolean firstSetBoolean(java.util.Map<java.lang.String,java.lang.String> map, boolean defaultValue, java.lang.String... keys)
public static java.lang.String toString(java.util.Collection<?> collection)
public static java.lang.String toString(java.util.Collection<?> collection, char delimiter)
public static java.lang.String toString(java.util.Map map)
public static int hashCode(java.lang.Iterable<? extends java.lang.Object> source)
public static int hashCode(int[] source)
public static <E> boolean equals(java.util.Collection<E> c1, java.util.Collection<E> c2)
public static <K,V> boolean equals(java.util.Map<K,V> m1, java.util.Map<K,V> m2)
public static <T> java.util.Collection<T> unmodifiableCollectionProxy(java.util.Collection<? extends T> c)
public static <T> java.util.Set<T> unmodifiableSetProxy(java.util.Set<? extends T> s)
public static <T> java.util.SortedSet<T> unmodifiableSortedSetProxy(java.util.SortedSet<T> s)
The returned sorted set will be serializable if the specified sorted set is serializable.
s
- the sorted set for which an unmodifiable view is to be
returned.public static <T> java.util.List<T> unmodifiableListProxy(java.util.List<? extends T> list)
public static <K,V> java.util.Map<K,V> unmodifiableMapProxy(java.util.Map<? extends K,? extends V> m)
The returned map will be serializable if the specified map is serializable.
m
- the map for which an unmodifiable view is to be returned.