|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.cleancode.util.ArrayPlus
public final class ArrayPlus
Convenience methods for array handling.
| Field Summary | |
|---|---|
static String |
NL
System dependent line separator. |
| Method Summary | |
|---|---|
static String |
arrayToString(Object[] data)
Convert a 1-dimensional Object array into a String
representation. |
static String |
arrayToString(Object[][] data)
Convert a 2-dimensional Object array into a String
representation. |
static String |
join(char separator,
Object[] anArray)
Joins array elements into a String with
the specified separator character. |
static String |
join(String separator,
Object[] anArray)
Joins array elements into a String with
the specified separator string. |
static String |
joinDecl(Object[] anArray)
Joins array elements into a String with
the specified separator string,
formatting the array as a Java declaration. |
static String[] |
push(String[] anArray,
String item)
Adds new last element to a String array. |
static String[] |
shift(String[] anArray)
Removes first element of a String array. |
static String[] |
shift(String[] anArray,
int n)
Removes 'n' elements of a String array. |
static String[] |
toStringArray(ArrayList data)
Convert an ArrayList containing strings into
an array of String (maintaining its String-iness
rather than getting an Object array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String NL
| Method Detail |
|---|
public static String[] toStringArray(ArrayList data)
ArrayList containing strings into
an array of String (maintaining its String-iness
rather than getting an Object array.
data - ArrayList containing String objects
String arraypublic static String arrayToString(Object[][] data)
Object array into a String
representation. Columns are tab-separated; rows are on separate lines.
data - 2-dimensional array
public static String arrayToString(Object[] data)
Object array into a String
representation. Items are on separate lines.
data - 1-dimensional array
public static String[] shift(String[] anArray)
String array.
anArray - array of String objects
public static String[] shift(String[] anArray,
int n)
String array.
anArray - array of String objectsn - number of elements to remove
public static String[] push(String[] anArray,
String item)
String array.
anArray - an array of String objectsitem - a String to push onto the array
public static String join(char separator,
Object[] anArray)
String with
the specified separator character.
separator - character to use to join the array elementsanArray - array of String objects
public static String join(String separator,
Object[] anArray)
String with
the specified separator string.
separator - string to use to join the array elementsanArray - array of String objects
public static String joinDecl(Object[] anArray)
String with
the specified separator string,
formatting the array as a Java declaration.
anArray - array of String objects
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
| CleanCode Java Libraries | Copyright © 2001-2012 Michael Sorens - Revised 2012.12.10 |