Package org.jumpmind.util
Class CollectionUtils
java.lang.Object
org.jumpmind.util.CollectionUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> T[]
add
(T[] one, T[] two) static <T> T[]
copyOf
(T[] original, int newLength) static <T,
U> T[] static <T> T[]
copyOfRange
(T[] original, int from, int to) Copies the specified range of the specified array into a new array.static <T,
U> T[] copyOfRange
(U[] original, int from, int to, Class<? extends T[]> newType) Copies the specified range of the specified array into a new array.static String
toCommaSeparatedValues
(Collection<?> list) toMap
(Properties properties)
-
Constructor Details
-
CollectionUtils
public CollectionUtils()
-
-
Method Details
-
toMap
-
toMap
-
copyOfRange
public static <T> T[] copyOfRange(T[] original, int from, int to) Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case null is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from.The resulting array is of exactly the same class as the original array.
- Parameters:
original
- the array from which a range is to be copiedfrom
- the initial index of the range to be copied, inclusiveto
- the final index of the range to be copied, exclusive. (This index may lie outside the array.)- Returns:
- a new array containing the specified range from the original array, truncated or padded with nulls to obtain the required length
- Throws:
ArrayIndexOutOfBoundsException
- if from < 0 or from > original.length()IllegalArgumentException
- if from > toNullPointerException
- if original is null- Since:
- 1.6
-
copyOfRange
Copies the specified range of the specified array into a new array. The initial index of the range (from) must lie between zero and original.length, inclusive. The value at original[from] is placed into the initial element of the copy (unless from == original.length or from == to). Values from subsequent elements in the original array are placed into subsequent elements in the copy. The final index of the range (to), which must be greater than or equal to from, may be greater than original.length, in which case null is placed in all elements of the copy whose index is greater than or equal to original.length - from. The length of the returned array will be to - from. The resulting array is of the class newType.- Parameters:
original
- the array from which a range is to be copiedfrom
- the initial index of the range to be copied, inclusiveto
- the final index of the range to be copied, exclusive. (This index may lie outside the array.)newType
- the class of the copy to be returned- Returns:
- a new array containing the specified range from the original array, truncated or padded with nulls to obtain the required length
- Throws:
ArrayIndexOutOfBoundsException
- if from < 0 or from > original.length()IllegalArgumentException
- if from > toNullPointerException
- if original is nullArrayStoreException
- if an element copied from original is not of a runtime type that can be stored in an array of class newType.- Since:
- 1.6
-
add
public static <T> T[] add(T[] one, T[] two) -
copyOf
public static <T> T[] copyOf(T[] original, int newLength) -
copyOf
-
toCommaSeparatedValues
-