|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.util.Collections
public class Collections
Static utility methods for processing collections.
| Method Summary | ||
|---|---|---|
static
|
addAll(Collection<? super E> c,
E[] xs)
Adds the elements from the specified array to the specified collection. |
|
static void |
elementsToStringBuffer(StringBuffer sb,
Collection<?> c)
Appends a string-based representation of the specified colleciton to the specified string buffer. |
|
static
|
getFirst(List<? extends E> l)
Returns the first member of the specified list. |
|
static
|
getFirst(Set<? extends E> s)
Returns the first member of the specified set. |
|
static
|
immutableSet(Collection<? extends E> elts)
|
|
static
|
immutableSet(E[] elts)
|
|
static boolean |
intersects(Set<?> set1,
Set<?> set2)
Returns true if the specified sets have at least one
element in common. |
|
static boolean |
isSingleton(Collection<?> c)
Returns true if the specified collection contains
exactly one member. |
|
static String |
listToString(List<?> ls)
Returns a string-based representation of the specified list. |
|
static void |
listToStringBuffer(StringBuffer sb,
List<?> ls)
Appends a string-based representation of the specified list to the specified string buffer. |
|
static String |
setToString(Set<?> s)
Returns a string-based representation of the specified set. |
|
static void |
setToStringBuffer(StringBuffer sb,
Set<?> c)
Appends a string-based representation of the specified set to the specified string buffer. |
|
static int[] |
toIntArray(Collection cs)
Returns an array of int consisting
of the elements of the specified collection converted
to int. |
|
static String[] |
toStringArray(Collection c)
Returns the elements in the specified collection as an array after converting each to a string. |
|
static void |
toStringArray(Collection c,
String[] members)
Writes the elements in the specified collection into the specified array as strings, beginning with the first position of the array. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static boolean isSingleton(Collection<?> c)
true if the specified collection contains
exactly one member.
c - Collection to test.
true if the specified collection contains
exactly one member.public static <E> E getFirst(List<? extends E> l)
l - List whose first member is returned.
IndexOutOfBoundsException - If the list is empty.public static <E> E getFirst(Set<? extends E> s)
s - Set whose first member is returned.
NoSuchElementException - If the set is empty.
public static boolean intersects(Set<?> set1,
Set<?> set2)
true if the specified sets have at least one
element in common.
set1 - First set.set2 - Second set.
true if the specified sets have at least
one element in common.
public static <E> void addAll(Collection<? super E> c,
E[] xs)
c - Collection to which objects are added.xs - Objects to add to the collection.public static String[] toStringArray(Collection c)
c - Collection to convert to an array.
public static void toStringArray(Collection c,
String[] members)
c - Collection to convert to an array.members - String rray to write collection into.
IndexOutOfBoundsException - If the size of the collection
is greater than the length of the array.public static int[] toIntArray(Collection cs)
int consisting
of the elements of the specified collection converted
to int. The collection must only consist of Integer
values.
cs - Collection of integers to convert to ints.
public static String setToString(Set<?> s)
s - Set to convert to string.
public static String listToString(List<?> ls)
ls - List to convert to string.
public static void listToStringBuffer(StringBuffer sb,
List<?> ls)
sb - String buffer to which the representation is appended.ls - List to append as a string.
public static void setToStringBuffer(StringBuffer sb,
Set<?> c)
sb - String buffer to which the representation is appended.c - Set to append as a string.
public static void elementsToStringBuffer(StringBuffer sb,
Collection<?> c)
sb - String buffer to which the representation is appended.c - Collection to append as a string.public static <E> Set<E> immutableSet(Collection<? extends E> elts)
public static <E> Set<E> immutableSet(E[] elts)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||