|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.javelot.functionalj.util.Lists
Methods concerning Collections, Lists and Sets.
| Field Summary | |
static Function1 |
sizeOf
|
| Method Summary | |
static boolean[] |
asBooleanArray(Collection p_coll)
Returns an array of booleans from a collection of
Booleans. |
static byte[] |
asByteArray(Collection p_coll)
Returns an array of bytes from a collection of
Bytes. |
static char[] |
asCharArray(Collection p_coll)
Returns an array of chars from a collection of
Characters. |
static double[] |
asDoubleArray(Collection p_coll)
Returns an array of doubles from a collection of
Doubles. |
static float[] |
asFloatArray(Collection p_coll)
Returns an array of floats from a collection of
Floats. |
static int[] |
asIntArray(Collection p_coll)
Returns an array of ints from a collection of
Integers. |
static List |
asList(boolean[] p_booleans)
Returns a List of Booleans from an array
of booleans. |
static List |
asList(byte[] p_bytes)
Returns a List of Bytes from an array
of bytes. |
static List |
asList(char[] p_chars)
Returns a List of Characters from an array
of chars. |
static List |
asList(double[] p_doubles)
Returns a List of Doubles from an array
of doubles. |
static List |
asList(float[] p_floats)
Returns a List of Floats from an array
of floats. |
static List |
asList(int[] p_ints)
Returns a List of Integers from an array
of ints. |
static List |
asList(long[] p_longs)
Returns a List of Longs from an array
of longs. |
static List |
asList(Object[] p_objects)
Returns a List from an array of Objects,
returning an empty List if the array is null. |
static List |
asList(short[] p_shorts)
Returns a List of Shorts from an array
of shorts. |
static List |
asList(String p_string)
Returns a List of Characters from a
String. |
static long[] |
asLongArray(Collection p_coll)
Returns an array of longs from a collection of
Longs. |
static short[] |
asShortArray(Collection p_coll)
Returns an array of shorts from a collection of
Shorts. |
static Object[] |
concat(Object[] p_array1,
Object[] p_array2)
Combines two arrays of parameters into one by concatenating the two, treating null arrays as zero-length arrays. |
static Object |
first(Collection p_collection)
Returns the first element of a collection. |
static Object |
first(Object[] p_array)
Version of first(Collection) which accepts an array. |
static List |
init(Collection p_collection)
Returns the initial of a collection, that is, all elements except the last. |
static List |
init(Object[] p_array)
Version of init(Collection) which accepts an array. |
static Object[] |
initArray(Object[] p_array)
Version of init(Collection) which accepts an array and returns an
array, without using an intermediate Collection. |
static Iterator |
iterator(Collection p_collection)
Returns the Iterator for the specified list, or an empty
iterator if the list is null, to avoid
NullPointerExceptions. |
static Iterator |
iterator(Object[] p_array)
Returns the Iterator for the specified array, or an empty
iterator if the array is null, to avoid
NullPointerExceptions. |
static Object |
last(Collection p_collection)
Returns the last element of a collection. |
static Object |
last(Object[] p_array)
Version of last(Collection) that accepts an array. |
static int |
sizeOf(Collection p_collection)
Returns the size of a collection, returning zero if the list is null. |
static int |
sizeOf(Object[] p_array)
Returns the size of a array, returning zero if the array is null. |
static Pair |
splitAt(int p_index,
List p_list)
Splits a list in two at the specified index, returning a pair of lists. |
static Pair |
splitAt(int p_index,
Object[] p_array)
Version of splitAt(int, List) that accepts an array. |
static Pair |
splitAtArray(int p_index,
Object[] p_array)
Version of splitAt(int, List) that accepts an array and returns a
Pair of arrays, without using an intermediate Collection. |
static List |
tail(Collection p_collection)
Returns the tail of a collection, that is, all elements except the first. |
static List |
tail(Object[] p_array)
Version of tail(Collection) which accepts an array. |
static Object[] |
tailArray(Object[] p_array)
Version of tail(Collection) which accepts an array and returns an
array, without using an intermediate Collection. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final Function1 sizeOf
| Method Detail |
public static Object first(Collection p_collection)
throws FunctionException
p_collection - the collection for which to return the first element.
FunctionException - thrown if the collection is null or
empty.
public static Object first(Object[] p_array)
throws FunctionException
first(Collection) which accepts an array.
FunctionExceptionpublic static Object last(Collection p_collection)
p_collection - the list for which to return the last element.
FunctionException - thrown if the collection is null or
empty.public static Object last(Object[] p_array)
last(Collection) that accepts an array.
public static List init(Collection p_collection)
p_collection - the collection for which to return the initial part.
public static List init(Object[] p_array)
init(Collection) which accepts an array.
public static Object[] initArray(Object[] p_array)
init(Collection) which accepts an array and returns an
array, without using an intermediate Collection.
public static List tail(Collection p_collection)
p_collection - the collection for which to return the tail.
public static List tail(Object[] p_array)
tail(Collection) which accepts an array.
public static Object[] tailArray(Object[] p_array)
tail(Collection) which accepts an array and returns an
array, without using an intermediate Collection.
public static Pair splitAt(int p_index,
List p_list)
Particular cases:
public static Pair splitAt(int p_index,
Object[] p_array)
splitAt(int, List) that accepts an array.
public static Pair splitAtArray(int p_index,
Object[] p_array)
splitAt(int, List) that accepts an array and returns a
Pair of arrays, without using an intermediate Collection.
public static int sizeOf(Collection p_collection)
null.
p_collection - the collection for which to return the size.
0 if the collection is
null.public static int sizeOf(Object[] p_array)
null.
p_array - the array for which to return the size.
0 if the array is
null.public static List asList(Object[] p_objects)
List from an array of Objects,
returning an empty List if the array is null.
p_objects - the array of Objects to be converted to
a List.
List of Objects.public static List asList(boolean[] p_booleans)
List of Booleans from an array
of booleans. Returns an empty list if the array is
null.
p_booleans - the array of boolean values to be converted to
a List.
List of Boolean objects.public static List asList(byte[] p_bytes)
List of Bytes from an array
of bytes. Returns an empty list if the array is
null.
p_bytes - the array of byte values to be converted to a
List.
List of Byte objects.public static List asList(char[] p_chars)
List of Characters from an array
of chars. Returns an empty list if the array is
null.
p_chars - the array of char values to be converted to a
List.
List of Character objects.public static List asList(double[] p_doubles)
List of Doubles from an array
of doubles. Returns an empty list if the array is
null.
p_doubles - the array of double values to be converted to a
List.
List of Double objects.public static List asList(float[] p_floats)
List of Floats from an array
of floats. Returns an empty list if the array is
null.
p_floats - the array of float values to be converted to a
List.
List of Float objects.public static List asList(int[] p_ints)
List of Integers from an array
of ints. Returns an empty list if the array is
null.
p_ints - the array of int values to be converted to a
List.
List of Integer objects.public static List asList(long[] p_longs)
List of Longs from an array
of longs. Returns an empty list if the array is
null.
p_longs - the array of long values to be converted to a
List.
List of Long objects.public static List asList(short[] p_shorts)
List of Shorts from an array
of shorts. Returns an empty list if the array is
null.
p_shorts - the array of short values to be converted to a
List.
List of Short objects.public static List asList(String p_string)
List of Characters from a
String. Returns an empty list if the string is
null.
p_string - the String to be converted to a
List.
List of Character objects.
public static Object[] concat(Object[] p_array1,
Object[] p_array2)
p_array1 - the first array.p_array2 - the second array.
public static boolean[] asBooleanArray(Collection p_coll)
booleans from a collection of
Booleans.
Returns an empty array if the collection is null.
p_coll - the collection of Booleans to be converted to an
array of booleans.
booleans.public static byte[] asByteArray(Collection p_coll)
bytes from a collection of
Bytes.
Returns an empty array if the collection is null.
p_coll - the collection of Bytes to be converted to an
array of bytes.
bytes.public static char[] asCharArray(Collection p_coll)
chars from a collection of
Characters.
Returns an empty array if the collection is null.
p_coll - the collection of Characters to be converted to an
array of chars.
chars.public static double[] asDoubleArray(Collection p_coll)
doubles from a collection of
Doubles.
Returns an empty array if the collection is null.
p_coll - the collection of Doubles to be converted to an
array of doubles.
doubles.public static float[] asFloatArray(Collection p_coll)
floats from a collection of
Floats.
Returns an empty array if the collection is null.
p_coll - the collection of Floats to be converted to an
array of floats.
floats.public static int[] asIntArray(Collection p_coll)
ints from a collection of
Integers.
Returns an empty array if the collection is null.
p_coll - the collection of Integers to be converted to an
array of ints.
ints.public static long[] asLongArray(Collection p_coll)
longs from a collection of
Longs.
Returns an empty array if the collection is null.
p_coll - the collection of Longs to be converted to an
array of longs.
longs.public static short[] asShortArray(Collection p_coll)
shorts from a collection of
Shorts.
Returns an empty array if the collection is null.
p_coll - the collection of Shorts to be converted to an
array of shorts.
shorts.public static Iterator iterator(Collection p_collection)
Iterator for the specified list, or an empty
iterator if the list is null, to avoid
NullPointerExceptions.
public static Iterator iterator(Object[] p_array)
Iterator for the specified array, or an empty
iterator if the array is null, to avoid
NullPointerExceptions.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||