|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opengts.util.ListTools
public class ListTools
Nested Class Summary | |
---|---|
static class |
ListTools.CollectionProxy<E>
CollectionProxy class |
static class |
ListTools.NameComparator<T>
NameComparator class for sorting objects based on their 'getName()' value |
static class |
ListTools.NumberComparator<T>
NumberComparator class for sorting objects based on their numeric value |
static class |
ListTools.ReverseOrderComparator<T>
ReverseOrderComparator class which reserses the sort order of other Comparators |
static class |
ListTools.StringComparator<T>
StringComparator class for sorting objects based on their 'toString()' value |
Field Summary | |
---|---|
static long |
RANDOM_SEED_MASK
|
Constructor Summary | |
---|---|
ListTools()
|
Method Summary | ||
---|---|---|
static double[] |
add(double[] list,
double obj)
Creates a new array with the specified object appended to the end of the specified array |
|
static int[] |
add(int[] list,
int obj)
Creates a new array with the specified object appended to the end of the specified array |
|
static
|
add(java.util.List<T> list,
T obj)
Adds the specified Object to the specified List |
|
static long[] |
add(long[] list,
long obj)
Creates a new array with the specified object appended to the end of the specified array |
|
static
|
add(T[] list,
T obj)
Creates a new array with the specified object appended to the end of the specified array |
|
static int |
compare(java.lang.Number n1,
java.lang.Number n2)
Compare compare 2 Numbers |
|
static int |
compare(java.lang.Number n1,
java.lang.Number n2,
boolean ascending)
Compare compare 2 Numbers |
|
static boolean |
contains(byte[] list,
byte item)
Returns true if the specified list contains the specified element |
|
static boolean |
contains(char[] list,
char item)
Returns true if the specified list contains the specified element |
|
static
|
contains(java.util.Collection<T> list,
T item)
Returns true if the specified list contains the specified element |
|
static boolean |
contains(double[] list,
double item,
double epsilon)
Returns true if the specified list contains the specified element |
|
static boolean |
contains(int[] list,
int item)
Returns true if the specified list contains the specified element |
|
static boolean |
contains(long[] list,
long item)
Returns true if the specified list contains the specified element |
|
static
|
contains(T[] list,
int ofs,
int len,
T item)
Returns true if the specified list contains the specified element |
|
static
|
contains(T[] list,
T item)
Returns true if the specified list contains the specified element |
|
static boolean |
containsIgnoreCase(java.util.Collection<java.lang.String> list,
java.lang.String item)
Returns true if the specified list contains the specified case-insensitive String value |
|
static boolean |
containsIgnoreCase(java.lang.String[] list,
java.lang.String item)
Returns true if the specified array contains the specified case-insensitive String value |
|
static
|
containsKey(java.util.Map<K,V> map,
K key)
Returns true if the specified map contains the specified key |
|
static int |
diff(boolean[] a1,
boolean[] a2)
Compares 2 boolean arrays, returning the index of the boolean where they differ |
|
static int |
diff(boolean[] a1,
boolean[] a2,
int len)
Compares 2 boolean arrays, returning the index of the boolean where they differ |
|
static int |
diff(byte[] a1,
byte[] a2)
Compares 2 byte arrays, returning the index of the byte where they differ |
|
static int |
diff(byte[] a1,
byte[] a2,
int len)
Compares 2 byte arrays, returning the index of the byte where they differ |
|
static int |
diff(char[] a1,
char[] a2)
Compares 2 character arrays, returning the index of the character where they differ |
|
static int |
diff(char[] a1,
char[] a2,
int len)
Compares 2 character arrays, returning the index of the character where they differ |
|
static int |
diff(double[] a1,
double[] a2)
Compares 2 double arrays, returning the index of the double where they differ |
|
static int |
diff(double[] a1,
double[] a2,
int len)
Compares 2 double arrays, returning the index of the double where they differ |
|
static int |
diff(int[] a1,
int[] a2)
Compares 2 int arrays, returning the index of the int where they differ |
|
static int |
diff(int[] a1,
int[] a2,
int len)
Compares 2 int arrays, returning the index of the int where they differ |
|
static int |
diff(long[] a1,
long[] a2)
Compares 2 long arrays, returning the index of the long where they differ |
|
static int |
diff(long[] a1,
long[] a2,
int len)
Compares 2 long arrays, returning the index of the long where they differ |
|
static
|
diff(T[] a1,
T[] a2)
Compares 2 Object arrays, returning the index of the Object where they differ |
|
static
|
diff(T[] a1,
T[] a2,
int len)
Compares 2 Object arrays, returning the index of the Object where they differ |
|
static boolean |
getBoolean(java.util.Map<java.lang.String,?> map,
java.lang.String key,
boolean dft,
boolean remove)
Gets the boolean value at the specified key in the specified map |
|
static double |
getDouble(java.util.Map<java.lang.String,?> map,
java.lang.String key,
double dft,
boolean remove)
Gets the double value at the specified key in the specified map |
|
static int |
getInt(java.util.Map<java.lang.String,?> map,
java.lang.String key,
int dft,
boolean remove)
Gets the int value at the specified key in the specified map |
|
static long |
getLong(java.util.Map<java.lang.String,?> map,
java.lang.String key,
long dft,
boolean remove)
Gets the long value at the specified key in the specified map |
|
static short |
getShort(java.util.Map<java.lang.String,?> map,
java.lang.String key,
short dft,
boolean remove)
Gets the short value at the specified key in the specified map |
|
static java.lang.String |
getString(java.util.Map<java.lang.String,?> map,
java.lang.String key,
java.lang.String dft,
boolean remove)
Gets the String value at the specified key in the specified map |
|
static int |
indexOf(byte[] list,
byte item)
Returns the index of the specified object within the specified array |
|
static int |
indexOf(char[] list,
char item)
Returns the index of the specified object within the specified array |
|
static
|
indexOf(java.util.Collection<T> list,
T item)
Returns the index of the specified element within the specified List |
|
static int |
indexOf(double[] list,
double item,
double epsilon)
Returns the index of the specified object within the specified array |
|
static int |
indexOf(int[] list,
int item)
Returns the index of the specified object within the specified array |
|
static int |
indexOf(long[] list,
long item)
Returns the index of the specified object within the specified array |
|
static
|
indexOf(T[] list,
int ofs,
int len,
T item)
Returns the index of the specified object within the specified array |
|
static
|
indexOf(T[] list,
T item)
Returns the index of the specified object within the specified array |
|
static int |
indexOfIgnoreCase(java.util.Collection<java.lang.String> list,
java.lang.String item)
Returns the index of the specified case-insensitive String value within the specified List. |
|
static int |
indexOfIgnoreCase(java.lang.String[] list,
java.lang.String item)
Returns the index of the specified case-insensitive String value within the specified array. |
|
static byte[] |
initArray(byte[] arry,
byte val)
Initialize all elements of specified array |
|
static double[] |
initArray(double[] arry,
double val)
Initialize all elements of specified array |
|
static int[] |
initArray(int[] arry,
int val)
Initialize all elements of specified array |
|
static long[] |
initArray(long[] arry,
long val)
Initialize all elements of specified array |
|
static double[] |
insert(double[] list,
double obj,
int index)
Creates a new array with the specified object inserted into specified array |
|
static int[] |
insert(int[] list,
int obj,
int index)
Creates a new array with the specified object inserted into specified array |
|
static
|
insert(java.util.List<T> list,
T obj,
int ndx)
Inserts the specified Object to the specified List, at the specified location |
|
static long[] |
insert(long[] list,
long obj,
int index)
Creates a new array with the specified object inserted into specified array |
|
static
|
insert(T[] list,
T obj,
int index)
Creates a new array with the specified object inserted into specified array |
|
static
|
isClassType(java.util.Collection<?> list,
java.lang.Class<T> type)
Returns true if all elements of the specified list are subclasses of the specified Class |
|
static boolean |
isEmpty(boolean[] B)
Returns true if the specified boolean array is null/empty |
|
static boolean |
isEmpty(byte[] B)
Returns true if the specified byte array is null/empty |
|
static boolean |
isEmpty(java.io.ByteArrayInputStream B)
Returns true if the specified ByteArrayInputStream is null/empty |
|
static boolean |
isEmpty(java.io.ByteArrayOutputStream B)
Returns true if the specified ByteArrayOutputStream is null/empty |
|
static boolean |
isEmpty(char[] C)
Returns true if the specified character array is null/empty |
|
static boolean |
isEmpty(java.util.Collection<?> C)
Returns true if the specified Collection is null/empty |
|
static boolean |
isEmpty(double[] D)
Returns true if the specified double array is null/empty |
|
static boolean |
isEmpty(int[] I)
Returns true if the specified int array is null/empty |
|
static boolean |
isEmpty(long[] L)
Returns true if the specified long array is null/empty |
|
static boolean |
isEmpty(java.util.Map<?,?> M)
Returns true if the specified Map is null/empty |
|
static
|
isEmpty(T[] A)
Returns true if the specified Object array is null/empty |
|
static byte |
itemAt(byte[] arry,
int ndx,
byte dft)
Returns the array item at the specified index, or the default value if the array has not such element |
|
static
|
itemAt(java.util.Collection<T> c,
int ndx,
T dft)
Returns the array item at the specified index, or the default value if the array has not such element |
|
static double |
itemAt(double[] arry,
int ndx,
double dft)
Returns the array item at the specified index, or the default value if the array has not such element |
|
static int |
itemAt(int[] arry,
int ndx,
int dft)
Returns the array item at the specified index, or the default value if the array has not such element |
|
static long |
itemAt(long[] arry,
int ndx,
long dft)
Returns the array item at the specified index, or the default value if the array has not such element |
|
static
|
itemAt(T[] arry,
int ndx,
T dft)
Returns the array item at the specified index, or the default value if the array has not such element |
|
static double[] |
joinArrays(double[] a1,
double[] a2)
Joins the specified arrays into a single array |
|
static double[] |
joinArrays(double[] a1,
double[] a2,
double[] a3)
Joins the specified arrays into a single array |
|
static double[] |
joinArrays(double[] a1,
double[] a2,
double[] a3,
double[] a4)
Joins the specified arrays into a single array |
|
static int[] |
joinArrays(int[] a1,
int[] a2)
Joins the specified arrays into a single array |
|
static int[] |
joinArrays(int[] a1,
int[] a2,
int[] a3)
Joins the specified arrays into a single array |
|
static int[] |
joinArrays(int[] a1,
int[] a2,
int[] a3,
int[] a4)
Joins the specified arrays into a single array |
|
static long[] |
joinArrays(long[] a1,
long[] a2)
Joins the specified arrays into a single array |
|
static long[] |
joinArrays(long[] a1,
long[] a2,
long[] a3)
Joins the specified arrays into a single array |
|
static long[] |
joinArrays(long[] a1,
long[] a2,
long[] a3,
long[] a4)
Joins the specified arrays into a single array |
|
static
|
joinArrays(T[] a1,
T[] a2)
Joins the specified arrays into a single array |
|
static
|
joinArrays(T[] a1,
T[] a2,
T[] a3)
Joins the specified arrays into a single array |
|
static
|
joinArrays(T[] a1,
T[] a2,
T[] a3,
T[] a4)
Joins the specified arrays into a single array |
|
static void |
main(java.lang.String[] argv)
Main entry point for testing/debugging |
|
static void |
randomSwap(byte[] list,
int x,
java.util.Random r)
Swap an item in the specified list with another random item |
|
static void |
randomSwap(char[] list,
int x,
java.util.Random r)
Swap an item in the specified list with another random item |
|
static void |
randomSwap(double[] list,
int x,
java.util.Random r)
Swap an item in the specified list with another random item |
|
static void |
randomSwap(int[] list,
int x,
java.util.Random r)
Swap an item in the specified list with another random item |
|
static
|
randomSwap(java.util.List<T> list,
int x,
java.util.Random r)
Swap an item in the specified list with another random item |
|
static void |
randomSwap(long[] list,
int x,
java.util.Random r)
Swap an item in the specified list with another random item |
|
static
|
randomSwap(T[] list,
int x,
java.util.Random r)
Swap an item in the specified list with another random item |
|
static double[] |
remove(double[] list,
int ndx)
Removes the element at the specified index from the specified array |
|
static int[] |
remove(int[] list,
int ndx)
Removes the element at the specified index from the specified array |
|
static
|
remove(java.util.List<T> list,
int ndx)
Removes the element at the specified index from the specified List |
|
static long[] |
remove(long[] list,
int ndx)
Removes the element at the specified index from the specified array |
|
static
|
remove(T[] list,
int ndx)
Removes the element at the specified index from the specified array |
|
static
|
reverseOrder(java.util.List<T> list)
Reverses the order of the elements in the specified List (in-place) |
|
static
|
reverseOrder(T[] list)
Reverses the order of the elements in the specified array (in-place) |
|
static byte[] |
shuffle(byte[] list,
java.math.BigInteger bigSeed)
Shuffle the array (in place) based on the specified randomizer |
|
static byte[] |
shuffle(byte[] list,
long seed)
Shuffle the array (in place) based on the specified randomizer |
|
static byte[] |
shuffle(byte[] list,
java.util.Random rand)
Shuffle the array (in place) based on the specified randomizer |
|
static char[] |
shuffle(char[] list,
java.math.BigInteger bigSeed)
Shuffle the array (in place) based on the specified randomizer |
|
static char[] |
shuffle(char[] list,
long seed)
Shuffle the array (in place) based on the specified randomizer |
|
static char[] |
shuffle(char[] list,
java.util.Random rand)
Shuffle the array (in place) based on the specified randomizer |
|
static int[] |
shuffle(int[] list,
java.math.BigInteger bigSeed)
Shuffle the array (in place) based on the specified randomizer |
|
static int[] |
shuffle(int[] list,
long seed)
Shuffle the array (in place) based on the specified randomizer |
|
static int[] |
shuffle(int[] list,
java.util.Random rand)
Shuffle the array (in place) based on the specified randomizer |
|
static java.lang.String |
shuffle(java.lang.String list,
java.math.BigInteger bigSeed)
Shuffle the String based on the specified randomizer |
|
static java.lang.String |
shuffle(java.lang.String list,
long seed)
Shuffle the String based on the specified randomizer |
|
static java.lang.String |
shuffle(java.lang.String list,
java.util.Random rand)
Shuffle the String based on the specified randomizer |
|
static
|
shuffle(T[] list,
java.math.BigInteger bigSeed)
Shuffle the array (in place) based on the specified randomizer seed |
|
static
|
shuffle(T[] list,
long seed)
Shuffle the array (in place) based on the specified randomizer |
|
static
|
shuffle(T[] list,
java.util.Random rand)
Shuffle the array (in place) based on the specified randomizer |
|
static int |
size(byte[] B)
Returns the size of the specified byte array |
|
static int |
size(java.io.ByteArrayInputStream B)
Returns the size of the specified ByteArrayInputStream |
|
static int |
size(java.io.ByteArrayOutputStream B)
Returns the size of the specified ByteArrayOutputStream |
|
static int |
size(char[] C)
Returns the size of the specified character array |
|
static int |
size(java.util.Collection<?> C)
Returns the size of the specified Collection |
|
static int |
size(double[] D)
Returns the size of the specified double array |
|
static int |
size(float[] F)
Returns the size of the specified float array |
|
static int |
size(int[] I)
Returns the size of the specified int array |
|
static int |
size(long[] L)
Returns the size of the specified long array |
|
static int |
size(java.util.Map<?,?> M)
Returns the size of the specified Map |
|
static int |
size(short[] S)
Returns the size of the specified short array |
|
static
|
size(T[] A)
Returns the size of the specified array |
|
static
|
sort(java.util.List<T> list,
java.util.Comparator<? super T> comp)
Sorts the specified List based on the specified Comparator |
|
static
|
sort(java.util.List<T> list,
java.util.Comparator<? super T> comp,
boolean forwardOrder)
Sorts the specified List based on the specified Comparator and sort order |
|
static java.lang.String[] |
sort(java.lang.String[] list)
Sorts the specified String array in ascending order |
|
static java.lang.String[] |
sort(java.lang.String[] list,
boolean forwardOrder)
Sorts the specified String array |
|
static
|
sort(T[] list,
java.util.Comparator<? super T> comp)
Sorts the specified array based on the specified Comparator |
|
static
|
sort(T[] list,
java.util.Comparator<? super T> comp,
boolean forwardOrder)
Sorts the specified array based on the specified Comparator |
|
static void |
swap(byte[] list,
int x,
int y)
Swap 2 items in the specified list |
|
static void |
swap(char[] list,
int x,
int y)
Swap 2 items in the specified list |
|
static void |
swap(double[] list,
int x,
int y)
Swap 2 items in the specified list |
|
static void |
swap(int[] list,
int x,
int y)
Swap 2 items in the specified list |
|
static
|
swap(java.util.List<T> list,
int x,
int y)
Swap 2 items in the specified list |
|
static void |
swap(long[] list,
int x,
int y)
Swap 2 items in the specified list |
|
static
|
swap(T[] list,
int x,
int y)
Swap 2 items in the specified list |
|
static byte[] |
toArray(byte[] arry,
int ofs,
int len)
Creates a new array containing a subset of the elements in the specified array |
|
static java.lang.Object[] |
toArray(java.util.Collection<?> list)
Copies the specified Collection to a new array |
|
static
|
toArray(java.util.Collection<?> list,
java.lang.Class<T> type)
Copies the specified Collection to a new array of the specified Class type |
|
static double[] |
toArray(double[] arry,
int ofs,
int len)
Creates a new array containing a subset of the elements in the specified array |
|
static
|
toArray(java.util.Enumeration<?> e,
java.lang.Class<T> type)
Copies the specified Enumeration to a new array of the specified Class type |
|
static int[] |
toArray(int[] arry,
int ofs,
int len)
Creates a new array containing a subset of the elements in the specified array |
|
static long[] |
toArray(long[] arry,
int ofs,
int len)
Creates a new array containing a subset of the elements in the specified array |
|
static
|
toArray(T[] arry,
int ofs,
int len)
Creates a new array containing a subset of the elements in the specified array |
|
static
|
toDoubleArray(java.util.Collection<N> list)
Creates a new 'double' array containing the elements in the specified 'Double' list |
|
static
|
toIntArray(java.util.Collection<N> list)
Creates a new 'int' array containing the elements in the specified 'Integer' list |
|
static
|
toIterator(java.util.Enumeration<T> e)
Converts the specified Enumeration into an Iterator |
|
static
|
toIterator(java.lang.Iterable<T> i)
Returns an Iterator for the specified Iterable |
|
static
|
toIterator(T[] list)
Returns an iterator over the elements in the specified array |
|
static
|
toList(java.util.Enumeration<T> e)
Copies the Enumeration to a List |
|
static
|
toList(java.util.Enumeration<T> e,
java.util.List<T> target)
Copies the Enumeration to a List |
|
static
|
toList(java.lang.Iterable<T> i)
Copies the Iterable to a List |
|
static
|
toList(java.lang.Iterable<T> i,
java.util.List<T> target)
Copies the Iterable to a List |
|
static
|
toList(java.util.Iterator<T> i)
Copies the Iterator to a List |
|
static
|
toList(java.util.Iterator<T> i,
java.util.List<T> target)
Copies the Iterator to a List |
|
static
|
toList(java.util.List<T> ls)
Copies the contents of the specified List to a new List |
|
static
|
toList(java.util.List<T> ls,
java.util.List<T> target)
Copies the specified list to a new List |
|
static
|
toList(java.util.List<T> target,
T... a)
Copies the specified array elements to a List |
|
static
|
toList(java.util.Set<T> s)
Copies the Set to a List |
|
static
|
toList(java.util.Set<T> s,
java.util.List<T> target)
Copies the Set to a List |
|
static java.util.List<java.lang.String> |
toList(java.util.StringTokenizer st)
Copies the StringTokenizer to a List |
|
static java.util.List<java.lang.String> |
toList(java.util.StringTokenizer st,
java.util.List<java.lang.String> target)
Copies the StringTokenizer to a List |
|
static
|
toList(T... a)
Copies the specified array elements to a List |
|
static
|
toList(T[] a,
int ofs,
int len,
java.util.List<T> target)
Copies the specified array elements to a List |
|
static
|
toList(T[] a,
java.util.List<T> target)
Copies the specified array elements to a List |
|
static
|
toListWrapper(T[] a)
Returns a java.util.List that is backed by the specified array |
|
static
|
toLongArray(java.util.Collection<N> list)
Creates a new 'long' array containing the elements in the specified 'Long' list |
|
static java.util.Map<java.lang.Object,java.lang.Object> |
toMap(java.lang.Object[][] arry)
Creates a new Map instance containing the elements from the specified array |
|
static java.util.Map<java.lang.Object,java.lang.Object> |
toMap(java.lang.Object[][] arry,
java.util.Map<java.lang.Object,java.lang.Object> map)
Creates a new Map instance containing the elements from the specified array |
|
static java.util.Map<java.lang.Object,java.lang.Object> |
toMap(java.lang.String keyMethod,
java.lang.Object[] arry)
Creates a Map instance containing the elements from the specified array. |
|
static java.util.Map<java.lang.Object,java.lang.Object> |
toMap(java.lang.String keyMethod,
java.lang.Object[] arry,
java.util.Map<java.lang.Object,java.lang.Object> map)
Creates a Map instance containing the elements from the specified array. |
|
static
|
toSet(java.util.Collection<T> c)
Copies the specified Collection to a new Set |
|
static
|
toSet(java.util.Collection<T> c,
java.util.Set<T> set)
Copies the specified Collection to a new Set |
|
static
|
toSet(java.util.Set<T> set,
T... a)
Copies the specified Object array to a new Set |
|
static
|
toSet(T... a)
Copies the specified Object array to a new Set |
|
static
|
toSet(T[] a,
int ofs,
int len,
java.util.Set<T> set)
Copies the specified Object array to a new Set |
|
static
|
toSet(T[] a,
java.util.Set<T> set)
Copies the specified Object array to a new Set |
|
static java.lang.String[] |
toStringArray(java.util.Collection<?> list)
Returns a String array comprised of toString() calls to the specified Collection of Objects |
|
static java.lang.String[] |
toStringArray(java.lang.Object[] a)
Returns a String array comprised of toString() calls to the specified Object array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static long RANDOM_SEED_MASK
Constructor Detail |
---|
public ListTools()
Method Detail |
---|
public static int size(java.io.ByteArrayOutputStream B)
B
- The ByteArrayOutputStream instance
public static int size(java.io.ByteArrayInputStream B)
B
- The ByteArrayInputStream instance
public static int size(java.util.Map<?,?> M)
M
- The Map instance
public static int size(java.util.Collection<?> C)
C
- The Collection instance
public static <T> int size(T[] A)
A
- The array instance
public static int size(char[] C)
C
- The character array instance
public static int size(byte[] B)
B
- The byte array instance
public static int size(short[] S)
S
- The short array instance
public static int size(int[] I)
I
- The int array instance
public static int size(long[] L)
L
- The long array instance
public static int size(float[] F)
F
- The float array instance
public static int size(double[] D)
D
- The double array instance
public static boolean isEmpty(java.io.ByteArrayOutputStream B)
B
- The ByteArrayOutputStream instance
public static boolean isEmpty(java.io.ByteArrayInputStream B)
B
- The ByteArrayInputStream instance
public static boolean isEmpty(java.util.Map<?,?> M)
M
- The Map instance
public static boolean isEmpty(java.util.Collection<?> C)
C
- The Collection instance
public static <T> boolean isEmpty(T[] A)
A
- The array instance
public static boolean isEmpty(boolean[] B)
B
- The boolean array instance
public static boolean isEmpty(char[] C)
C
- The character array instance
public static boolean isEmpty(byte[] B)
B
- The byte array instance
public static boolean isEmpty(int[] I)
I
- The int array instance
public static boolean isEmpty(long[] L)
L
- The long array instance
public static boolean isEmpty(double[] D)
D
- The double array instance
public static int diff(boolean[] a1, boolean[] a2)
a1
- First boolean arraya2
- Second boolean array
public static int diff(boolean[] a1, boolean[] a2, int len)
a1
- First boolean arraya2
- Second boolean arraylen
- Length of array to compare
public static int diff(char[] a1, char[] a2)
a1
- First character arraya2
- Second character array
public static int diff(char[] a1, char[] a2, int len)
a1
- First character arraya2
- Second character arraylen
- Length of array to compare
public static int diff(byte[] a1, byte[] a2)
a1
- First byte arraya2
- Second byte array
public static int diff(byte[] a1, byte[] a2, int len)
a1
- First byte arraya2
- Second byte arraylen
- Length of array to compare
public static int diff(int[] a1, int[] a2)
a1
- First int arraya2
- Second int array
public static int diff(int[] a1, int[] a2, int len)
a1
- First int arraya2
- Second int arraylen
- Length of array to compare
public static int diff(long[] a1, long[] a2)
a1
- First long arraya2
- Second long array
public static int diff(long[] a1, long[] a2, int len)
a1
- First long arraya2
- Second long arraylen
- Length of array to compare
public static int diff(double[] a1, double[] a2)
a1
- First double arraya2
- Second double array
public static int diff(double[] a1, double[] a2, int len)
a1
- First double arraya2
- Second double arraylen
- Length of array to compare
public static <T> int diff(T[] a1, T[] a2)
a1
- First Object arraya2
- Second Object array
public static <T> int diff(T[] a1, T[] a2, int len)
a1
- First Object arraya2
- Second Object arraylen
- Length of array to compare
public static <T> T itemAt(java.util.Collection<T> c, int ndx, T dft)
c
- The item Collection
ndx
- The item indexdft
- The default item value if no such element exists
public static <T> T itemAt(T[] arry, int ndx, T dft)
arry
- The item arrayndx
- The item indexdft
- The default item value if no such element exists
public static byte itemAt(byte[] arry, int ndx, byte dft)
arry
- The item arrayndx
- The item indexdft
- The default item value if no such element exists
public static int itemAt(int[] arry, int ndx, int dft)
arry
- The item arrayndx
- The item indexdft
- The default item value if no such element exists
public static long itemAt(long[] arry, int ndx, long dft)
arry
- The item arrayndx
- The item indexdft
- The default item value if no such element exists
public static double itemAt(double[] arry, int ndx, double dft)
arry
- The item arrayndx
- The item indexdft
- The default item value if no such element exists
public static <T> int indexOf(java.util.Collection<T> list, T item)
list
- The List instance containing the specified elementitem
- The List element for which the index will be returned
public static int indexOfIgnoreCase(java.util.Collection<java.lang.String> list, java.lang.String item)
list
- The List containing String valuesitem
- The String value for which the index will be returned
public static int indexOfIgnoreCase(java.lang.String[] list, java.lang.String item)
list
- The array containing String valuesitem
- The String value for which the index will be returned
public static <T> int indexOf(T[] list, T item)
list
- The array containing the specified objectitem
- The element for which the index will be returned
public static <T> int indexOf(T[] list, int ofs, int len, T item)
list
- The array containing the specified objectofs
- The offset within the array to begin searchinglen
- The number of elements to search within the arrayitem
- The element for which the index will be returned
public static int indexOf(char[] list, char item)
list
- The array containing the specified objectitem
- The element for which the index will be returned
public static int indexOf(byte[] list, byte item)
list
- The array containing the specified objectitem
- The element for which the index will be returned
public static int indexOf(int[] list, int item)
list
- The array containing the specified objectitem
- The element for which the index will be returned
public static int indexOf(long[] list, long item)
list
- The array containing the specified objectitem
- The element for which the index will be returned
public static int indexOf(double[] list, double item, double epsilon)
list
- The array containing the specified objectitem
- The element for which the index will be returnedepsilon
- A small allowed margin of error.
public static <T> boolean contains(java.util.Collection<T> list, T item)
list
- The List instance to searchitem
- The element which is tested for inclusion in the specified List
public static boolean containsIgnoreCase(java.util.Collection<java.lang.String> list, java.lang.String item)
list
- The List instance to searchitem
- The case-insensitive String which is tested for inclusion in the specified List
public static boolean containsIgnoreCase(java.lang.String[] list, java.lang.String item)
list
- The array instance to searchitem
- The element which is tested for inclusion in the specified array
public static <T> boolean contains(T[] list, T item)
list
- The array instance to searchitem
- The element which is tested for inclusion in the specified array
public static <T> boolean contains(T[] list, int ofs, int len, T item)
list
- The array instance to searchofs
- The offset within the array to begin searchinglen
- The number of elements to searchitem
- The element which is tested for inclusion in the specified array
public static boolean contains(char[] list, char item)
list
- The array instance to searchitem
- The element which is tested for inclusion in the specified array
public static boolean contains(byte[] list, byte item)
list
- The array instance to searchitem
- The element which is tested for inclusion in the specified array
public static boolean contains(int[] list, int item)
list
- The array instance to searchitem
- The element which is tested for inclusion in the specified array
public static boolean contains(long[] list, long item)
list
- The array instance to searchitem
- The element which is tested for inclusion in the specified array
public static boolean contains(double[] list, double item, double epsilon)
list
- The array instance to searchitem
- The element which is tested for inclusion in the specified arrayepsilon
- A small allowed margin of error.
public static <K,V> boolean containsKey(java.util.Map<K,V> map, K key)
map
- The Map instance to searchkey
- The key which is tested for inclusion in the specified Map
public static <T> boolean isClassType(java.util.Collection<?> list, java.lang.Class<T> type)
list
- The List to checktype
- The Class object used to check against all elements in the List
public static byte[] initArray(byte[] arry, byte val)
arry
- The arrayval
- The value used to initialize the elements in the arraypublic static int[] initArray(int[] arry, int val)
arry
- The arrayval
- The value used to initialize the elements in the arraypublic static long[] initArray(long[] arry, long val)
arry
- The arrayval
- The value used to initialize the elements in the arraypublic static double[] initArray(double[] arry, double val)
arry
- The arrayval
- The value used to initialize the elements in the arraypublic static <T> java.util.AbstractList<T> toListWrapper(T[] a)
a
- The array
public static <T> java.util.List<T> toList(T... a)
a
- The object array to copy to a List instance
public static <T> java.util.List<T> toList(java.util.List<T> target, T... a)
target
- The List instance to which the elements of the Object array will be copieda
- The object array to copy to a List instance
public static <T> java.util.List<T> toList(T[] a, java.util.List<T> target)
a
- The object array to copy to a List instancetarget
- The List instance to which the elements of the Object array will be copied
public static <T> java.util.List<T> toList(T[] a, int ofs, int len, java.util.List<T> target)
a
- The object array to copy to a List instanceofs
- The offset within the specified Object array to begin copying to listlen
- The number of elements from the specified Object array to copy to listtarget
- The List instance to which the elements of the object array will be copied
public static <T> java.util.List<T> toList(java.util.Enumeration<T> e)
e
- The Enumeration to copy to a List instance
public static <T> java.util.List<T> toList(java.util.Enumeration<T> e, java.util.List<T> target)
e
- The Enumeration to copy to a List instancetarget
- The List instance to which the elements from the Enumeration will be copied
public static <T> java.util.List<T> toList(java.util.Iterator<T> i)
i
- The Iterator to copy to a List instance
public static <T> java.util.List<T> toList(java.util.Iterator<T> i, java.util.List<T> target)
i
- The Iterator to copy to a List instancetarget
- The List instance to which the elements from the Iterator will be copied
public static <T> java.util.List<T> toList(java.lang.Iterable<T> i)
i
- The Iterable to copy to a List instance
public static <T> java.util.List<T> toList(java.lang.Iterable<T> i, java.util.List<T> target)
i
- The Iterable to copy to a List instancetarget
- The List instance to which the elements from the Iterable will be copied
public static <T> java.util.List<T> toList(java.util.Set<T> s)
s
- The Set to copy to a List instance
public static <T> java.util.List<T> toList(java.util.Set<T> s, java.util.List<T> target)
s
- The Set to copy to a List instancetarget
- The List instance to which the elements from the Set will be copied
public static java.util.List<java.lang.String> toList(java.util.StringTokenizer st)
st
- The StringTokenizer to copy to a List instance
public static java.util.List<java.lang.String> toList(java.util.StringTokenizer st, java.util.List<java.lang.String> target)
st
- The StringTokenizer to copy to a List instancetarget
- The List instance to which the elements from the StringTokenizer will be copied
public static <T> java.util.List<T> toList(java.util.List<T> ls)
ls
- The List to copy to a new List instance
public static <T> java.util.List<T> toList(java.util.List<T> ls, java.util.List<T> target)
ls
- The List to copy to a new List instancetarget
- The List instance to which the elements from the specified List will be copied
public static <T> T[] toArray(java.util.Enumeration<?> e, java.lang.Class<T> type)
e
- The Enumeration to copy to the new arraytype
- The Class type of the return array
public static java.lang.Object[] toArray(java.util.Collection<?> list)
list
- The Collection to copy to the new array
public static <T> T[] toArray(java.util.Collection<?> list, java.lang.Class<T> type)
list
- The Collection to copy to the new arraytype
- The Class type of the return array
public static <T> T[] toArray(T[] arry, int ofs, int len)
arry
- The array containing elements to be copied to a new arrayofs
- The offset within arry
to begin copyinglen
- The number of elements to copy to the new array
public static byte[] toArray(byte[] arry, int ofs, int len)
arry
- The array containing elements to be copied to a new arrayofs
- The offset within arry
to begin copyinglen
- The number of elements to copy to the new array
public static int[] toArray(int[] arry, int ofs, int len)
arry
- The array containing elements to be copied to a new arrayofs
- The offset within arry
to begin copyinglen
- The number of elements to copy to the new array
public static long[] toArray(long[] arry, int ofs, int len)
arry
- The array containing elements to be copied to a new arrayofs
- The offset within arry
to begin copyinglen
- The number of elements to copy to the new array
public static double[] toArray(double[] arry, int ofs, int len)
arry
- The array containing elements to be copied to a new arrayofs
- The offset within arry
to begin copyinglen
- The number of elements to copy to the new array
public static <N extends java.lang.Number> int[] toIntArray(java.util.Collection<N> list)
list
- The Collection to copy to the new array
public static <N extends java.lang.Number> long[] toLongArray(java.util.Collection<N> list)
list
- The Collection to copy to the new array
public static <N extends java.lang.Number> double[] toDoubleArray(java.util.Collection<N> list)
list
- The Collection to copy to the new array
public static java.lang.String[] toStringArray(java.lang.Object[] a)
a
- The Object array
public static java.lang.String[] toStringArray(java.util.Collection<?> list)
list
- The Object Collection
public static <T> java.util.Set<T> toSet(T... a)
a
- The array to copy to a new Set
public static <T> java.util.Set<T> toSet(java.util.Set<T> set, T... a)
set
- The Set to which the array elements will be copieda
- The array to copy to the Set
public static <T> java.util.Set<T> toSet(T[] a, java.util.Set<T> set)
a
- The array to copy to the Setset
- The Set to which the array elements will be copied
public static <T> java.util.Set<T> toSet(T[] a, int ofs, int len, java.util.Set<T> set)
a
- The array to copy to the Setofs
- The offset within 'a' to begin copyinglen
- The number of elements to copy to the new arrayset
- The Set to which the array elements will be copied
public static <T> java.util.Set<T> toSet(java.util.Collection<T> c)
c
- The Collection to copy to the Set
public static <T> java.util.Set<T> toSet(java.util.Collection<T> c, java.util.Set<T> set)
c
- The Collection to copy to the Setset
- The Set to which the Collection elements will be copied
public static java.util.Map<java.lang.Object,java.lang.Object> toMap(java.lang.Object[][] arry)
arry
- The array from which the Map instance will be created. For each row major
element in the array, the first column will be the key, and the second column
will be the value.
public static java.util.Map<java.lang.Object,java.lang.Object> toMap(java.lang.Object[][] arry, java.util.Map<java.lang.Object,java.lang.Object> map)
arry
- The array from which the Map instance will be created. For each row major
element in the array, the first column will be the key, and the second column
will be the value.map
- The map instance to which key/value elements from the specified array will be
copied. If null, a new OrderedMap will be created.
public static java.util.Map<java.lang.Object,java.lang.Object> toMap(java.lang.String keyMethod, java.lang.Object[] arry)
keyMethod
- The method name invoked on the array element to retrieve the
element key.arry
- The array added to the map.
public static java.util.Map<java.lang.Object,java.lang.Object> toMap(java.lang.String keyMethod, java.lang.Object[] arry, java.util.Map<java.lang.Object,java.lang.Object> map)
keyMethod
- The method name invoked on the array element to retrieve the
element key.arry
- The array added to the map.map
- The map to which the array elements will be added. If null,
a new OrderedMap instance will be created.
public static <T> java.util.List<T> add(java.util.List<T> list, T obj)
list
- The List to which the specified object will be addedobj
- The Object to add to the specified List
public static <T> T[] add(T[] list, T obj)
list
- The array to which the object will be appendedobj
- The object to append to the specified array
public static int[] add(int[] list, int obj)
list
- The array to which the object will be appendedobj
- The object to append to the specified array
public static long[] add(long[] list, long obj)
list
- The array to which the object will be appendedobj
- The object to append to the specified array
public static double[] add(double[] list, double obj)
list
- The array to which the object will be appendedobj
- The object to append to the specified array
public static <T> T[] joinArrays(T[] a1, T[] a2, T[] a3, T[] a4)
a1
- The 1st arraya2
- The 2nd arraya3
- The 3rd arraya4
- The 4th array
public static <T> T[] joinArrays(T[] a1, T[] a2, T[] a3)
a1
- The 1st arraya2
- The 2nd arraya3
- The 3rd array
public static <T> T[] joinArrays(T[] a1, T[] a2)
a1
- The 1st arraya2
- The 2nd array
public static double[] joinArrays(double[] a1, double[] a2, double[] a3, double[] a4)
a1
- The 1st arraya2
- The 2nd arraya3
- The 3rd arraya4
- The 4th array
public static double[] joinArrays(double[] a1, double[] a2, double[] a3)
a1
- The 1st arraya2
- The 2nd arraya3
- The 3rd array
public static double[] joinArrays(double[] a1, double[] a2)
a1
- The 1st arraya2
- The 2nd array
public static long[] joinArrays(long[] a1, long[] a2, long[] a3, long[] a4)
a1
- The 1st arraya2
- The 2nd arraya3
- The 3rd arraya4
- The 4th array
public static long[] joinArrays(long[] a1, long[] a2, long[] a3)
a1
- The 1st arraya2
- The 2nd arraya3
- The 3rd array
public static long[] joinArrays(long[] a1, long[] a2)
a1
- The 1st arraya2
- The 2nd array
public static int[] joinArrays(int[] a1, int[] a2, int[] a3, int[] a4)
a1
- The 1st arraya2
- The 2nd arraya3
- The 3rd arraya4
- The 4th array
public static int[] joinArrays(int[] a1, int[] a2, int[] a3)
a1
- The 1st arraya2
- The 2nd arraya3
- The 3rd array
public static int[] joinArrays(int[] a1, int[] a2)
a1
- The 1st arraya2
- The 2nd array
public static <T> java.util.List<T> insert(java.util.List<T> list, T obj, int ndx)
list
- The List to which the specified object will be insertedobj
- The Object to insert into the specified Listndx
- The location in the List instance where the object will be inserted
list
instance to which the object was insertedpublic static <T> T[] insert(T[] list, T obj, int index)
list
- The array to which the object will be insertedobj
- The object to insert into the specified arrayindex
- The location where the object will be inserted
public static int[] insert(int[] list, int obj, int index)
list
- The array to which the object will be insertedobj
- The object to insert into the specified arrayindex
- The location where the object will be inserted
public static long[] insert(long[] list, long obj, int index)
list
- The array to which the object will be insertedobj
- The object to insert into the specified arrayindex
- The location where the object will be inserted
public static double[] insert(double[] list, double obj, int index)
list
- The array to which the object will be insertedobj
- The object to insert into the specified arrayindex
- The location where the object will be inserted
public static <T> java.util.List<T> remove(java.util.List<T> list, int ndx)
list
- The List from which the element at the specified index will be removedndx
- The index of the element to remove from the specified List
list
instance from which the element was removedpublic static <T> T[] remove(T[] list, int ndx)
list
- The array from which the element will be removedndx
- The index of the element to remove from the specified array
public static int[] remove(int[] list, int ndx)
list
- The array from which the element will be removedndx
- The index of the element to remove from the specified array
public static long[] remove(long[] list, int ndx)
list
- The array from which the element will be removedndx
- The index of the element to remove from the specified array
public static double[] remove(double[] list, int ndx)
list
- The array from which the element will be removedndx
- The index of the element to remove from the specified array
public static <T> java.util.Iterator<T> toIterator(java.lang.Iterable<T> i)
i
- The Iterable
public static <T> java.util.Iterator<T> toIterator(java.util.Enumeration<T> e)
e
- The Enumeration
public static <T> java.util.Iterator<T> toIterator(T[] list)
list
- The array
public static <T> java.util.List<T> sort(java.util.List<T> list, java.util.Comparator<? super T> comp)
list
- The list to sort (in-place)comp
- The Comparator used to sort the specified List
public static <T> java.util.List<T> sort(java.util.List<T> list, java.util.Comparator<? super T> comp, boolean forwardOrder)
list
- The list to sort (in-place)comp
- The Comparator used to sort the specified ListforwardOrder
- True to sort based on the Comparator, false to sort based on the
reverse order of the Comparator
public static <T> T[] sort(T[] list, java.util.Comparator<? super T> comp)
list
- The array to sort (in-place)comp
- The Comparator used to sort the specified array
public static <T> T[] sort(T[] list, java.util.Comparator<? super T> comp, boolean forwardOrder)
list
- The array to sort (in-place)comp
- The Comparator used to sort the specified arrayforwardOrder
- True to sort based on the Comparator, false to sort based on the
reverse order of the Comparator
public static java.lang.String[] sort(java.lang.String[] list)
list
- The array to sort (in-place)
public static java.lang.String[] sort(java.lang.String[] list, boolean forwardOrder)
list
- The array to sort (in-place)forwardOrder
- True to sort ascending, false descending
public static int compare(java.lang.Number n1, java.lang.Number n2)
public static int compare(java.lang.Number n1, java.lang.Number n2, boolean ascending)
public static <T> T[] reverseOrder(T[] list)
list
- The array in which to reverse the order of elements (in-place)
public static <T> java.util.List<T> reverseOrder(java.util.List<T> list)
list
- The List in which to reverse the order of elements (in-place)
public static <T> void swap(java.util.List<T> list, int x, int y)
list
- The listx
- The first indexy
- The second indexpublic static <T> void randomSwap(java.util.List<T> list, int x, java.util.Random r)
list
- The listx
- The first indexr
- Random instance used to generate random indexpublic static <T> void swap(T[] list, int x, int y)
list
- The listx
- The first indexy
- The second indexpublic static <T> void randomSwap(T[] list, int x, java.util.Random r)
list
- The listx
- The first indexr
- Random instance used to generate random indexpublic static void swap(char[] list, int x, int y)
list
- The listx
- The first indexy
- The second indexpublic static void randomSwap(char[] list, int x, java.util.Random r)
list
- The listx
- The first indexr
- Random instance used to generate random indexpublic static void swap(byte[] list, int x, int y)
list
- The listx
- The first indexy
- The second indexpublic static void randomSwap(byte[] list, int x, java.util.Random r)
list
- The listx
- The first indexr
- Random instance used to generate random indexpublic static void swap(int[] list, int x, int y)
list
- The listx
- The first indexy
- The second indexpublic static void randomSwap(int[] list, int x, java.util.Random r)
list
- The listx
- The first indexr
- Random instance used to generate random indexpublic static void swap(long[] list, int x, int y)
list
- The listx
- The first indexy
- The second indexpublic static void randomSwap(long[] list, int x, java.util.Random r)
list
- The listx
- The first indexr
- Random instance used to generate random indexpublic static void swap(double[] list, int x, int y)
list
- The listx
- The first indexy
- The second indexpublic static void randomSwap(double[] list, int x, java.util.Random r)
list
- The listx
- The first indexr
- Random instance used to generate random indexpublic static <T> T[] shuffle(T[] list, java.math.BigInteger bigSeed)
list
- The list to shufflebigSeed
- The randomizer seed
public static <T> T[] shuffle(T[] list, long seed)
list
- The list to shuffleseed
- The randomizer seed
public static <T> T[] shuffle(T[] list, java.util.Random rand)
list
- The list to shufflerand
- The randomizer
public static char[] shuffle(char[] list, java.math.BigInteger bigSeed)
list
- The list to shufflebigSeed
- The randomizer seed
public static char[] shuffle(char[] list, long seed)
list
- The list to shuffleseed
- The randomizer seed
public static char[] shuffle(char[] list, java.util.Random rand)
list
- The list to shufflerand
- The randomizer
public static java.lang.String shuffle(java.lang.String list, java.math.BigInteger bigSeed)
list
- The String to shufflebigSeed
- The randomizer seed
public static java.lang.String shuffle(java.lang.String list, long seed)
list
- The String to shuffleseed
- The randomizer seed
public static java.lang.String shuffle(java.lang.String list, java.util.Random rand)
list
- The String to shufflerand
- The randomizer
public static byte[] shuffle(byte[] list, java.math.BigInteger bigSeed)
list
- The list to shufflebigSeed
- The randomizer seed
public static byte[] shuffle(byte[] list, long seed)
list
- The list to shuffleseed
- The randomizer seed
public static byte[] shuffle(byte[] list, java.util.Random rand)
list
- The list to shufflerand
- The randomizer
public static int[] shuffle(int[] list, java.math.BigInteger bigSeed)
list
- The list to shufflebigSeed
- The randomizer seed
public static int[] shuffle(int[] list, long seed)
list
- The list to shuffleseed
- The randomizer seed
public static int[] shuffle(int[] list, java.util.Random rand)
list
- The list to shufflerand
- The randomizer
public static boolean getBoolean(java.util.Map<java.lang.String,?> map, java.lang.String key, boolean dft, boolean remove)
map
- The map from which the value is retrievedkey
- The key for which the value is retrieveddft
- The default value if the key is not present in the mapremove
- True to remove the key from the map
public static short getShort(java.util.Map<java.lang.String,?> map, java.lang.String key, short dft, boolean remove)
map
- The map from which the value is retrievedkey
- The key for which the value is retrieveddft
- The default value if the key is not present in the mapremove
- True to remove the key from the map
public static int getInt(java.util.Map<java.lang.String,?> map, java.lang.String key, int dft, boolean remove)
map
- The map from which the value is retrievedkey
- The key for which the value is retrieveddft
- The default value if the key is not present in the mapremove
- True to remove the key from the map
public static long getLong(java.util.Map<java.lang.String,?> map, java.lang.String key, long dft, boolean remove)
map
- The map from which the value is retrievedkey
- The key for which the value is retrieveddft
- The default value if the key is not present in the mapremove
- True to remove the key from the map
public static double getDouble(java.util.Map<java.lang.String,?> map, java.lang.String key, double dft, boolean remove)
map
- The map from which the value is retrievedkey
- The key for which the value is retrieveddft
- The default value if the key is not present in the mapremove
- True to remove the key from the map
public static java.lang.String getString(java.util.Map<java.lang.String,?> map, java.lang.String key, java.lang.String dft, boolean remove)
map
- The map from which the value is retrievedkey
- The key for which the value is retrieveddft
- The default value if the key is not present in the mapremove
- True to remove the key from the map
public static void main(java.lang.String[] argv)
argv
- Comand-line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |