|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.aliasi.util.Arrays
public class Arrays
Static utility methods for processing arrays.
| Field Summary | |
|---|---|
static int[] |
EMPTY_INT_ARRAY
A length 0 array of integers. |
| Method Summary | ||
|---|---|---|
static char[] |
add(char c,
char[] cs)
Return the result of adding the specified character to the specified sorted character array. |
|
static String |
arrayToString(Object[] xs)
Returns the concatenation of the string representations of the specified objects separated by commas, with the whole surrounded by square brackets and separated by a comma. |
|
static void |
arrayToStringBuilder(StringBuilder sb,
Object[] xs)
Appends to the string buffer the concatenation of the string representations of the specified objects separated by commas, with the whole surrounded by square brackets and separated by a comma. |
|
static char[] |
concatenate(char[] cs,
char c)
Returns the array of characters consisting of the members of the first specified array followed by the specified character. |
|
static String[] |
concatenate(String[] xs,
String[] ys)
Returns a new array of strings containing the elements of the first array of strings specified followed by the elements of the second array of strings specified. |
|
static char[] |
copy(char[] cs)
Return a shallow copy of the specified array that contains the same elements as the specified array. |
|
static boolean |
equals(Object[] xs,
Object[] ys)
Return true if the specified arrays are
the same length and contain the same elements. |
|
static boolean |
member(char c,
char[] cs)
Returns true if the specified character is a member of the specified array. |
|
static boolean |
member(Object x,
Object[] xs)
Returns true if the specified object is an element of the specified array. |
|
static
|
permute(E[] xs)
Randomly permutes the elements of the specified array using a freshly generated randomizer. |
|
static
|
permute(E[] xs,
Random random)
Randomly permutes the elements of the specified array using the specified randomizer. |
|
static void |
permute(int[] xs)
Randomly permutes the elements of the specified integer array using a newly created randomizer. |
|
static void |
permute(int[] xs,
Random random)
Randomly permutes the elements of the specified integer array using the specified randomizer. |
|
static
|
reallocate(E[] xs,
int newSize)
Returns a copy of the specified array of objects of the specified size. |
|
static int[] |
reallocate(int[] xs)
Reallocates the specified integer array to be 50 percent longer, with a minimum growth in length of one element. |
|
static int[] |
reallocate(int[] xs,
int newSize)
Returns a copy of the specified array of integers of the specified size. |
|
static char[] |
toArray(CharSequence cSeq)
Converts the specified character sequence to an array of characters. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int[] EMPTY_INT_ARRAY
0 array of integers.
| Method Detail |
|---|
public static <E> E[] reallocate(E[] xs,
int newSize)
As many of the original elements as will fit in the new array are copied into the returned array. If the new size is longer, the remaining elements will be null.
E - type of objects in array.xs - Original array.newSize - Size of returned array.
public static int[] reallocate(int[] xs,
int newSize)
xs - Original array.newSize - Length of returned array.
public static int[] reallocate(int[] xs)
0).
xs - Array to reallocate.
public static char[] add(char c,
char[] cs)
Warning: No check is done that the incoming character array is in order.
c - Character to add.cs - Array of characters in sorted order.
public static char[] copy(char[] cs)
null, then null
is returned.
cs - Array to copy.
public static char[] toArray(CharSequence cSeq)
cSeq - Character sequence to convert.
public static boolean member(Object x,
Object[] xs)
false if the specified
array is null.
x - Object to test for membership.xs - Array to test for object.
true if the specified object is an element
of the specified array.
public static boolean member(char c,
char[] cs)
false if the specified
array is null.
c - Character to test for membership.cs - Array to test for character.
true if the specified character is an
element of the specified array.public static String arrayToString(Object[] xs)
xs - Array of which to return a string representation.
public static void arrayToStringBuilder(StringBuilder sb,
Object[] xs)
sb - String buffer to which string representation is
appended.xs - Array of which to return a string representation.
public static char[] concatenate(char[] cs,
char c)
cs - Characters to start resulting array.c - Last character in resulting array.
NullPointerException - If the array of characters is
null.
public static String[] concatenate(String[] xs,
String[] ys)
xs - First array of strings.ys - Second array of strings.
public static boolean equals(Object[] xs,
Object[] ys)
true if the specified arrays are
the same length and contain the same elements.
xs - First array.ys - Second array.
true if the specified arrays are the same
length and contain the same elements.public static <E> void permute(E[] xs)
E - the type of objects in the array being permutedxs - Array to permute.
public static <E> void permute(E[] xs,
Random random)
E - the type of objects in the array being permutedxs - Array to permute.random - Randomizer to use for permuation.public static void permute(int[] xs)
Random.Random().
xs - Array to permute.
public static void permute(int[] xs,
Random random)
xs - Array to permute.random - Randomizer to use for permutations.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||