public class CollectionUtil extends Object
| Constructor and Description |
|---|
CollectionUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <E,T extends E> |
add(List<E> list,
int index,
T item)
Adds the given item to the list at specified
index. |
static <E,T extends E> |
addAll(Collection<E> c,
T... array)
Adds objects in array to the given collection
|
static <T> List<T> |
filter(Collection<T> c,
Filter<T> filter)
Returns List with elements from given collections which are selected
by specified filter
|
static <K,V> K |
getKey(Map<K,V> map,
V value)
returns key whose value matches with specified value from given map
if the given map contains multiple keys mapped to specified value, it
returns first key encountered
|
static Properties |
readProperties(InputStream is,
Properties props)
Reads Properties from given inputStream and returns it.
|
static <E,T extends E> |
removeAll(Collection<E> c,
T... array)
Removes objects in array to the given collection
|
static boolean[] |
toBooleanArray(Collection<Boolean> c) |
static byte[] |
toByteArray(Collection<? extends Number> c) |
static double[] |
toDoubleArray(Collection<? extends Number> c) |
static float[] |
toFloatArray(Collection<? extends Number> c) |
static int[] |
toIntArray(Collection<? extends Number> c) |
static long[] |
toLongArray(Collection<? extends Number> c) |
static short[] |
toShortArray(Collection<? extends Number> c) |
public static Properties readProperties(InputStream is, Properties props) throws IOException
IOExceptionpublic static <E,T extends E> Collection<E> addAll(Collection<E> c, T... array)
public static <E,T extends E> Collection<E> removeAll(Collection<E> c, T... array)
public static <E,T extends E> void add(List<E> list, int index, T item)
index.
if index is greater than list size, it simply appends
to the list.public static <T> List<T> filter(Collection<T> c, Filter<T> filter)
public static <K,V> K getKey(Map<K,V> map, V value)
public static boolean[] toBooleanArray(Collection<Boolean> c)
public static int[] toIntArray(Collection<? extends Number> c)
public static long[] toLongArray(Collection<? extends Number> c)
public static float[] toFloatArray(Collection<? extends Number> c)
public static double[] toDoubleArray(Collection<? extends Number> c)
public static byte[] toByteArray(Collection<? extends Number> c)
public static short[] toShortArray(Collection<? extends Number> c)
Copyright © 2021. All rights reserved.