org.opengts.util
Class ListTools

java.lang.Object
  extended by org.opengts.util.ListTools

public class ListTools
extends java.lang.Object


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
<T> java.util.List<T>
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
<T> T[]
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
<T> boolean
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
<T> boolean
contains(T[] list, int ofs, int len, T item)
          Returns true if the specified list contains the specified element
static
<T> boolean
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
<K,V> boolean
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
<T> int
diff(T[] a1, T[] a2)
          Compares 2 Object arrays, returning the index of the Object where they differ
static
<T> int
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
<T> int
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
<T> int
indexOf(T[] list, int ofs, int len, T item)
          Returns the index of the specified object within the specified array
static
<T> int
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
<T> java.util.List<T>
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
<T> T[]
insert(T[] list, T obj, int index)
          Creates a new array with the specified object inserted into specified array
static
<T> boolean
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
<T> boolean
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
<T> T
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
<T> T
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
<T> T[]
joinArrays(T[] a1, T[] a2)
          Joins the specified arrays into a single array
static
<T> T[]
joinArrays(T[] a1, T[] a2, T[] a3)
          Joins the specified arrays into a single array
static
<T> T[]
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
<T> void
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
<T> void
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
<T> java.util.List<T>
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
<T> T[]
remove(T[] list, int ndx)
          Removes the element at the specified index from the specified array
static
<T> java.util.List<T>
reverseOrder(java.util.List<T> list)
          Reverses the order of the elements in the specified List (in-place)
static
<T> T[]
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
<T> T[]
shuffle(T[] list, java.math.BigInteger bigSeed)
          Shuffle the array (in place) based on the specified randomizer seed
static
<T> T[]
shuffle(T[] list, long seed)
          Shuffle the array (in place) based on the specified randomizer
static
<T> T[]
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
<T> int
size(T[] A)
          Returns the size of the specified array
static
<T> java.util.List<T>
sort(java.util.List<T> list, java.util.Comparator<? super T> comp)
          Sorts the specified List based on the specified Comparator
static
<T> java.util.List<T>
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
<T> T[]
sort(T[] list, java.util.Comparator<? super T> comp)
          Sorts the specified array based on the specified Comparator
static
<T> T[]
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
<T> void
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
<T> void
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
<T> T[]
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
<T> T[]
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
<T> T[]
toArray(T[] arry, int ofs, int len)
          Creates a new array containing a subset of the elements in the specified array
static
<N extends java.lang.Number>
double[]
toDoubleArray(java.util.Collection<N> list)
          Creates a new 'double' array containing the elements in the specified 'Double' list
static
<N extends java.lang.Number>
int[]
toIntArray(java.util.Collection<N> list)
          Creates a new 'int' array containing the elements in the specified 'Integer' list
static
<T> java.util.Iterator<T>
toIterator(java.util.Enumeration<T> e)
          Converts the specified Enumeration into an Iterator
static
<T> java.util.Iterator<T>
toIterator(java.lang.Iterable<T> i)
          Returns an Iterator for the specified Iterable
static
<T> java.util.Iterator<T>
toIterator(T[] list)
          Returns an iterator over the elements in the specified array
static
<T> java.util.List<T>
toList(java.util.Enumeration<T> e)
          Copies the Enumeration to a List
static
<T> java.util.List<T>
toList(java.util.Enumeration<T> e, java.util.List<T> target)
          Copies the Enumeration to a List
static
<T> java.util.List<T>
toList(java.lang.Iterable<T> i)
          Copies the Iterable to a List
static
<T> java.util.List<T>
toList(java.lang.Iterable<T> i, java.util.List<T> target)
          Copies the Iterable to a List
static
<T> java.util.List<T>
toList(java.util.Iterator<T> i)
          Copies the Iterator to a List
static
<T> java.util.List<T>
toList(java.util.Iterator<T> i, java.util.List<T> target)
          Copies the Iterator to a List
static
<T> java.util.List<T>
toList(java.util.List<T> ls)
          Copies the contents of the specified List to a new List
static
<T> java.util.List<T>
toList(java.util.List<T> ls, java.util.List<T> target)
          Copies the specified list to a new List
static
<T> java.util.List<T>
toList(java.util.List<T> target, T... a)
          Copies the specified array elements to a List
static
<T> java.util.List<T>
toList(java.util.Set<T> s)
          Copies the Set to a List
static
<T> java.util.List<T>
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
<T> java.util.List<T>
toList(T... a)
          Copies the specified array elements to a List
static
<T> java.util.List<T>
toList(T[] a, int ofs, int len, java.util.List<T> target)
          Copies the specified array elements to a List
static
<T> java.util.List<T>
toList(T[] a, java.util.List<T> target)
          Copies the specified array elements to a List
static
<T> java.util.AbstractList<T>
toListWrapper(T[] a)
          Returns a java.util.List that is backed by the specified array
static
<N extends java.lang.Number>
long[]
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
<T> java.util.Set<T>
toSet(java.util.Collection<T> c)
          Copies the specified Collection to a new Set
static
<T> java.util.Set<T>
toSet(java.util.Collection<T> c, java.util.Set<T> set)
          Copies the specified Collection to a new Set
static
<T> java.util.Set<T>
toSet(java.util.Set<T> set, T... a)
          Copies the specified Object array to a new Set
static
<T> java.util.Set<T>
toSet(T... a)
          Copies the specified Object array to a new Set
static
<T> java.util.Set<T>
toSet(T[] a, int ofs, int len, java.util.Set<T> set)
          Copies the specified Object array to a new Set
static
<T> java.util.Set<T>
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

RANDOM_SEED_MASK

public static long RANDOM_SEED_MASK
Constructor Detail

ListTools

public ListTools()
Method Detail

size

public static int size(java.io.ByteArrayOutputStream B)
Returns the size of the specified ByteArrayOutputStream

Parameters:
B - The ByteArrayOutputStream instance
Returns:
The size of the specified ByteArrayOutputStream

size

public static int size(java.io.ByteArrayInputStream B)
Returns the size of the specified ByteArrayInputStream

Parameters:
B - The ByteArrayInputStream instance
Returns:
The size of the specified ByteArrayInputStream

size

public static int size(java.util.Map<?,?> M)
Returns the size of the specified Map

Parameters:
M - The Map instance
Returns:
The size of the specified Map

size

public static int size(java.util.Collection<?> C)
Returns the size of the specified Collection

Parameters:
C - The Collection instance
Returns:
The size of the specified Collection

size

public static <T> int size(T[] A)
Returns the size of the specified array

Parameters:
A - The array instance
Returns:
The size of the specified array

size

public static int size(char[] C)
Returns the size of the specified character array

Parameters:
C - The character array instance
Returns:
The size of the specified character array

size

public static int size(byte[] B)
Returns the size of the specified byte array

Parameters:
B - The byte array instance
Returns:
The size of the specified byte array

size

public static int size(short[] S)
Returns the size of the specified short array

Parameters:
S - The short array instance
Returns:
The size of the specified short array

size

public static int size(int[] I)
Returns the size of the specified int array

Parameters:
I - The int array instance
Returns:
The size of the specified int array

size

public static int size(long[] L)
Returns the size of the specified long array

Parameters:
L - The long array instance
Returns:
The size of the specified long array

size

public static int size(float[] F)
Returns the size of the specified float array

Parameters:
F - The float array instance
Returns:
The size of the specified float array

size

public static int size(double[] D)
Returns the size of the specified double array

Parameters:
D - The double array instance
Returns:
The size of the specified double array

isEmpty

public static boolean isEmpty(java.io.ByteArrayOutputStream B)
Returns true if the specified ByteArrayOutputStream is null/empty

Parameters:
B - The ByteArrayOutputStream instance
Returns:
True if the specified ByteArrayOutputStream is null/empty

isEmpty

public static boolean isEmpty(java.io.ByteArrayInputStream B)
Returns true if the specified ByteArrayInputStream is null/empty

Parameters:
B - The ByteArrayInputStream instance
Returns:
True if the specified ByteArrayInputStream is null/empty

isEmpty

public static boolean isEmpty(java.util.Map<?,?> M)
Returns true if the specified Map is null/empty

Parameters:
M - The Map instance
Returns:
True if the specified Map is null/empty

isEmpty

public static boolean isEmpty(java.util.Collection<?> C)
Returns true if the specified Collection is null/empty

Parameters:
C - The Collection instance
Returns:
True if the specified Collection is null/empty

isEmpty

public static <T> boolean isEmpty(T[] A)
Returns true if the specified Object array is null/empty

Parameters:
A - The array instance
Returns:
True if the specified array is null/empty

isEmpty

public static boolean isEmpty(boolean[] B)
Returns true if the specified boolean array is null/empty

Parameters:
B - The boolean array instance
Returns:
True if the specified boolean array is null/empty

isEmpty

public static boolean isEmpty(char[] C)
Returns true if the specified character array is null/empty

Parameters:
C - The character array instance
Returns:
True if the specified character array is null/empty

isEmpty

public static boolean isEmpty(byte[] B)
Returns true if the specified byte array is null/empty

Parameters:
B - The byte array instance
Returns:
True if the specified byte array is null/empty

isEmpty

public static boolean isEmpty(int[] I)
Returns true if the specified int array is null/empty

Parameters:
I - The int array instance
Returns:
True if the specified int array is null/empty

isEmpty

public static boolean isEmpty(long[] L)
Returns true if the specified long array is null/empty

Parameters:
L - The long array instance
Returns:
True if the specified long array is null/empty

isEmpty

public static boolean isEmpty(double[] D)
Returns true if the specified double array is null/empty

Parameters:
D - The double array instance
Returns:
True if the specified double array is null/empty

diff

public static int diff(boolean[] a1,
                       boolean[] a2)
Compares 2 boolean arrays, returning the index of the boolean where they differ

Parameters:
a1 - First boolean array
a2 - Second boolean array
Returns:
The index/location where the boolean arrays differ, or -1 if they are the same

diff

public static int diff(boolean[] a1,
                       boolean[] a2,
                       int len)
Compares 2 boolean arrays, returning the index of the boolean where they differ

Parameters:
a1 - First boolean array
a2 - Second boolean array
len - Length of array to compare
Returns:
The index/location where the boolean arrays differ, or -1 if they are the same

diff

public static int diff(char[] a1,
                       char[] a2)
Compares 2 character arrays, returning the index of the character where they differ

Parameters:
a1 - First character array
a2 - Second character array
Returns:
The index/location where the character arrays differ, or -1 if they are the same

diff

public static int diff(char[] a1,
                       char[] a2,
                       int len)
Compares 2 character arrays, returning the index of the character where they differ

Parameters:
a1 - First character array
a2 - Second character array
len - Length of array to compare
Returns:
The index/location where the character arrays differ, or -1 if they are the same

diff

public static int diff(byte[] a1,
                       byte[] a2)
Compares 2 byte arrays, returning the index of the byte where they differ

Parameters:
a1 - First byte array
a2 - Second byte array
Returns:
The index/location where the byte arrays differ, or -1 if they are the same

diff

public static int diff(byte[] a1,
                       byte[] a2,
                       int len)
Compares 2 byte arrays, returning the index of the byte where they differ

Parameters:
a1 - First byte array
a2 - Second byte array
len - Length of array to compare
Returns:
The index/location where the byte arrays differ, or -1 if they are the same

diff

public static int diff(int[] a1,
                       int[] a2)
Compares 2 int arrays, returning the index of the int where they differ

Parameters:
a1 - First int array
a2 - Second int array
Returns:
The index/location where the int arrays differ, or -1 if they are the same

diff

public static int diff(int[] a1,
                       int[] a2,
                       int len)
Compares 2 int arrays, returning the index of the int where they differ

Parameters:
a1 - First int array
a2 - Second int array
len - Length of array to compare
Returns:
The index/location where the int arrays differ, or -1 if they are the same

diff

public static int diff(long[] a1,
                       long[] a2)
Compares 2 long arrays, returning the index of the long where they differ

Parameters:
a1 - First long array
a2 - Second long array
Returns:
The index/location where the long arrays differ, or -1 if they are the same

diff

public static int diff(long[] a1,
                       long[] a2,
                       int len)
Compares 2 long arrays, returning the index of the long where they differ

Parameters:
a1 - First long array
a2 - Second long array
len - Length of array to compare
Returns:
The index/location where the long arrays differ, or -1 if they are the same

diff

public static int diff(double[] a1,
                       double[] a2)
Compares 2 double arrays, returning the index of the double where they differ

Parameters:
a1 - First double array
a2 - Second double array
Returns:
The index/location where the double arrays differ, or -1 if they are the same

diff

public static int diff(double[] a1,
                       double[] a2,
                       int len)
Compares 2 double arrays, returning the index of the double where they differ

Parameters:
a1 - First double array
a2 - Second double array
len - Length of array to compare
Returns:
The index/location where the double arrays differ, or -1 if they are the same

diff

public static <T> int diff(T[] a1,
                           T[] a2)
Compares 2 Object arrays, returning the index of the Object where they differ

Parameters:
a1 - First Object array
a2 - Second Object array
Returns:
The index/location where the Object arrays differ, or -1 if they are the same

diff

public static <T> int diff(T[] a1,
                           T[] a2,
                           int len)
Compares 2 Object arrays, returning the index of the Object where they differ

Parameters:
a1 - First Object array
a2 - Second Object array
len - Length of array to compare
Returns:
The index/location where the Object arrays differ, or -1 if they are the same

itemAt

public static <T> T 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

Parameters:
c - The item Collection
ndx - The item index
dft - The default item value if no such element exists
Returns:
The item at the specified index

itemAt

public static <T> T 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

Parameters:
arry - The item array
ndx - The item index
dft - The default item value if no such element exists
Returns:
The item at the specified index

itemAt

public 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

Parameters:
arry - The item array
ndx - The item index
dft - The default item value if no such element exists
Returns:
The item at the specified index

itemAt

public 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

Parameters:
arry - The item array
ndx - The item index
dft - The default item value if no such element exists
Returns:
The item at the specified index

itemAt

public 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

Parameters:
arry - The item array
ndx - The item index
dft - The default item value if no such element exists
Returns:
The item at the specified index

itemAt

public 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

Parameters:
arry - The item array
ndx - The item index
dft - The default item value if no such element exists
Returns:
The item at the specified index

indexOf

public static <T> int indexOf(java.util.Collection<T> list,
                              T item)
Returns the index of the specified element within the specified List

Parameters:
list - The List instance containing the specified element
item - The List element for which the index will be returned
Returns:
The index of the specified element within the specified List, or -1 if the specified element was not found in the specified List

indexOfIgnoreCase

public 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.

Parameters:
list - The List containing String values
item - The String value for which the index will be returned
Returns:
The index of the specified case-insensitive String value within the specified List, or -1 if the case-insensitive String value was not found.

indexOfIgnoreCase

public 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.

Parameters:
list - The array containing String values
item - The String value for which the index will be returned
Returns:
The index of the specified case-insensitive String value within the specified array, or -1 if the case-insensitive String value was not found.

indexOf

public static <T> int indexOf(T[] list,
                              T item)
Returns the index of the specified object within the specified array

Parameters:
list - The array containing the specified object
item - The element for which the index will be returned
Returns:
The index of the specified element within the specified array, or -1 if the specified element was not found in the specified array

indexOf

public static <T> int indexOf(T[] list,
                              int ofs,
                              int len,
                              T item)
Returns the index of the specified object within the specified array

Parameters:
list - The array containing the specified object
ofs - The offset within the array to begin searching
len - The number of elements to search within the array
item - The element for which the index will be returned
Returns:
The index of the specified element within the specified array, or -1 if the specified element was not found in the specified array

indexOf

public static int indexOf(char[] list,
                          char item)
Returns the index of the specified object within the specified array

Parameters:
list - The array containing the specified object
item - The element for which the index will be returned
Returns:
The index of the specified element within the specified array, or -1 if the specified element was not found in the specified array

indexOf

public static int indexOf(byte[] list,
                          byte item)
Returns the index of the specified object within the specified array

Parameters:
list - The array containing the specified object
item - The element for which the index will be returned
Returns:
The index of the specified element within the specified array, or -1 if the specified element was not found in the specified array

indexOf

public static int indexOf(int[] list,
                          int item)
Returns the index of the specified object within the specified array

Parameters:
list - The array containing the specified object
item - The element for which the index will be returned
Returns:
The index of the specified element within the specified array, or -1 if the specified element was not found in the specified array

indexOf

public static int indexOf(long[] list,
                          long item)
Returns the index of the specified object within the specified array

Parameters:
list - The array containing the specified object
item - The element for which the index will be returned
Returns:
The index of the specified element within the specified array, or -1 if the specified element was not found in the specified array

indexOf

public static int indexOf(double[] list,
                          double item,
                          double epsilon)
Returns the index of the specified object within the specified array

Parameters:
list - The array containing the specified object
item - The element for which the index will be returned
epsilon - A small allowed margin of error.
Returns:
The index of the specified element within the specified array, or -1 if the specified element was not found in the specified array

contains

public static <T> boolean contains(java.util.Collection<T> list,
                                   T item)
Returns true if the specified list contains the specified element

Parameters:
list - The List instance to search
item - The element which is tested for inclusion in the specified List
Returns:
True if the specified List contains the specified element

containsIgnoreCase

public 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

Parameters:
list - The List instance to search
item - The case-insensitive String which is tested for inclusion in the specified List
Returns:
True if the List contains the specified case-insensitive String value

containsIgnoreCase

public static boolean containsIgnoreCase(java.lang.String[] list,
                                         java.lang.String item)
Returns true if the specified array contains the specified case-insensitive String value

Parameters:
list - The array instance to search
item - The element which is tested for inclusion in the specified array
Returns:
True if the array contains the specified element

contains

public static <T> boolean contains(T[] list,
                                   T item)
Returns true if the specified list contains the specified element

Parameters:
list - The array instance to search
item - The element which is tested for inclusion in the specified array
Returns:
True if the array contains the specified element

contains

public static <T> boolean contains(T[] list,
                                   int ofs,
                                   int len,
                                   T item)
Returns true if the specified list contains the specified element

Parameters:
list - The array instance to search
ofs - The offset within the array to begin searching
len - The number of elements to search
item - The element which is tested for inclusion in the specified array
Returns:
True if the array contains the specified element

contains

public static boolean contains(char[] list,
                               char item)
Returns true if the specified list contains the specified element

Parameters:
list - The array instance to search
item - The element which is tested for inclusion in the specified array
Returns:
True if the array contains the specified element

contains

public static boolean contains(byte[] list,
                               byte item)
Returns true if the specified list contains the specified element

Parameters:
list - The array instance to search
item - The element which is tested for inclusion in the specified array
Returns:
True if the array contains the specified element

contains

public static boolean contains(int[] list,
                               int item)
Returns true if the specified list contains the specified element

Parameters:
list - The array instance to search
item - The element which is tested for inclusion in the specified array
Returns:
True if the array contains the specified element

contains

public static boolean contains(long[] list,
                               long item)
Returns true if the specified list contains the specified element

Parameters:
list - The array instance to search
item - The element which is tested for inclusion in the specified array
Returns:
True if the array contains the specified element

contains

public static boolean contains(double[] list,
                               double item,
                               double epsilon)
Returns true if the specified list contains the specified element

Parameters:
list - The array instance to search
item - The element which is tested for inclusion in the specified array
epsilon - A small allowed margin of error.
Returns:
True if the array contains the specified element

containsKey

public static <K,V> boolean containsKey(java.util.Map<K,V> map,
                                        K key)
Returns true if the specified map contains the specified key

Parameters:
map - The Map instance to search
key - The key which is tested for inclusion in the specified Map
Returns:
True if the specified Map contains the specified key

isClassType

public static <T> boolean 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

Parameters:
list - The List to check
type - The Class object used to check against all elements in the List
Returns:
True if all elements in the List are subclasses of the specified Class

initArray

public static byte[] initArray(byte[] arry,
                               byte val)
Initialize all elements of specified array

Parameters:
arry - The array
val - The value used to initialize the elements in the array

initArray

public static int[] initArray(int[] arry,
                              int val)
Initialize all elements of specified array

Parameters:
arry - The array
val - The value used to initialize the elements in the array

initArray

public static long[] initArray(long[] arry,
                               long val)
Initialize all elements of specified array

Parameters:
arry - The array
val - The value used to initialize the elements in the array

initArray

public static double[] initArray(double[] arry,
                                 double val)
Initialize all elements of specified array

Parameters:
arry - The array
val - The value used to initialize the elements in the array

toListWrapper

public static <T> java.util.AbstractList<T> toListWrapper(T[] a)
Returns a java.util.List that is backed by the specified array

Parameters:
a - The array
Returns:
The java.util.List wrapper

toList

public static <T> java.util.List<T> toList(T... a)
Copies the specified array elements to a List

Parameters:
a - The object array to copy to a List instance
Returns:
The List instance containing the elements of the specified array

toList

public static <T> java.util.List<T> toList(java.util.List<T> target,
                                           T... a)
Copies the specified array elements to a List

Parameters:
target - The List instance to which the elements of the Object array will be copied
a - The object array to copy to a List instance
Returns:
The List instance containing the elements of the specified array

toList

public static <T> java.util.List<T> toList(T[] a,
                                           java.util.List<T> target)
Copies the specified array elements to a List

Parameters:
a - The object array to copy to a List instance
target - The List instance to which the elements of the Object array will be copied
Returns:
The List instance containing the elements of the specified array

toList

public static <T> java.util.List<T> toList(T[] a,
                                           int ofs,
                                           int len,
                                           java.util.List<T> target)
Copies the specified array elements to a List

Parameters:
a - The object array to copy to a List instance
ofs - The offset within the specified Object array to begin copying to list
len - The number of elements from the specified Object array to copy to list
target - The List instance to which the elements of the object array will be copied
Returns:
The List instance containing the elements of the specified array

toList

public static <T> java.util.List<T> toList(java.util.Enumeration<T> e)
Copies the Enumeration to a List

Parameters:
e - The Enumeration to copy to a List instance
Returns:
The List instance containing the elements of the Enumeration

toList

public static <T> java.util.List<T> toList(java.util.Enumeration<T> e,
                                           java.util.List<T> target)
Copies the Enumeration to a List

Parameters:
e - The Enumeration to copy to a List instance
target - The List instance to which the elements from the Enumeration will be copied
Returns:
The List instance containing the elements of the Enumeration

toList

public static <T> java.util.List<T> toList(java.util.Iterator<T> i)
Copies the Iterator to a List

Parameters:
i - The Iterator to copy to a List instance
Returns:
The List instance containing the elements of the Iterator

toList

public static <T> java.util.List<T> toList(java.util.Iterator<T> i,
                                           java.util.List<T> target)
Copies the Iterator to a List

Parameters:
i - The Iterator to copy to a List instance
target - The List instance to which the elements from the Iterator will be copied
Returns:
The List instance containing the elements of the Iterator

toList

public static <T> java.util.List<T> toList(java.lang.Iterable<T> i)
Copies the Iterable to a List

Parameters:
i - The Iterable to copy to a List instance
Returns:
The List instance containing the elements of the Iterable

toList

public static <T> java.util.List<T> toList(java.lang.Iterable<T> i,
                                           java.util.List<T> target)
Copies the Iterable to a List

Parameters:
i - The Iterable to copy to a List instance
target - The List instance to which the elements from the Iterable will be copied
Returns:
The List instance containing the elements of the Iterable

toList

public static <T> java.util.List<T> toList(java.util.Set<T> s)
Copies the Set to a List

Parameters:
s - The Set to copy to a List instance
Returns:
The List instance containing the elements of the Set

toList

public static <T> java.util.List<T> toList(java.util.Set<T> s,
                                           java.util.List<T> target)
Copies the Set to a List

Parameters:
s - The Set to copy to a List instance
target - The List instance to which the elements from the Set will be copied
Returns:
The List instance containing the elements of the Set

toList

public static java.util.List<java.lang.String> toList(java.util.StringTokenizer st)
Copies the StringTokenizer to a List

Parameters:
st - The StringTokenizer to copy to a List instance
Returns:
The List instance containing the elements of the StringTokenizer

toList

public 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

Parameters:
st - The StringTokenizer to copy to a List instance
target - The List instance to which the elements from the StringTokenizer will be copied
Returns:
The List instance containing the elements of the StringTokenizer

toList

public static <T> java.util.List<T> toList(java.util.List<T> ls)
Copies the contents of the specified List to a new List

Parameters:
ls - The List to copy to a new List instance
Returns:
The List instance containing the elements of the specified List

toList

public static <T> java.util.List<T> toList(java.util.List<T> ls,
                                           java.util.List<T> target)
Copies the specified list to a new List

Parameters:
ls - The List to copy to a new List instance
target - The List instance to which the elements from the specified List will be copied
Returns:
The List instance containing the elements of the specified List

toArray

public static <T> T[] toArray(java.util.Enumeration<?> e,
                              java.lang.Class<T> type)
Copies the specified Enumeration to a new array of the specified Class type

Parameters:
e - The Enumeration to copy to the new array
type - The Class type of the return array
Returns:
An array containing the elements from the Enumeration

toArray

public static java.lang.Object[] toArray(java.util.Collection<?> list)
Copies the specified Collection to a new array

Parameters:
list - The Collection to copy to the new array
Returns:
An array containing the elements from the Collection

toArray

public static <T> T[] toArray(java.util.Collection<?> list,
                              java.lang.Class<T> type)
Copies the specified Collection to a new array of the specified Class type

Parameters:
list - The Collection to copy to the new array
type - The Class type of the return array
Returns:
An array containing the elements from the Collection

toArray

public static <T> T[] toArray(T[] arry,
                              int ofs,
                              int len)
Creates a new array containing a subset of the elements in the specified array

Parameters:
arry - The array containing elements to be copied to a new array
ofs - The offset within arry to begin copying
len - The number of elements to copy to the new array
Returns:
The new subset array

toArray

public static byte[] toArray(byte[] arry,
                             int ofs,
                             int len)
Creates a new array containing a subset of the elements in the specified array

Parameters:
arry - The array containing elements to be copied to a new array
ofs - The offset within arry to begin copying
len - The number of elements to copy to the new array
Returns:
The new subset array

toArray

public static int[] toArray(int[] arry,
                            int ofs,
                            int len)
Creates a new array containing a subset of the elements in the specified array

Parameters:
arry - The array containing elements to be copied to a new array
ofs - The offset within arry to begin copying
len - The number of elements to copy to the new array
Returns:
The new subset array

toArray

public static long[] toArray(long[] arry,
                             int ofs,
                             int len)
Creates a new array containing a subset of the elements in the specified array

Parameters:
arry - The array containing elements to be copied to a new array
ofs - The offset within arry to begin copying
len - The number of elements to copy to the new array
Returns:
The new subset array

toArray

public static double[] toArray(double[] arry,
                               int ofs,
                               int len)
Creates a new array containing a subset of the elements in the specified array

Parameters:
arry - The array containing elements to be copied to a new array
ofs - The offset within arry to begin copying
len - The number of elements to copy to the new array
Returns:
The new subset array

toIntArray

public static <N extends java.lang.Number> int[] toIntArray(java.util.Collection<N> list)
Creates a new 'int' array containing the elements in the specified 'Integer' list

Parameters:
list - The Collection to copy to the new array
Returns:
The new 'int' array

toLongArray

public static <N extends java.lang.Number> long[] toLongArray(java.util.Collection<N> list)
Creates a new 'long' array containing the elements in the specified 'Long' list

Parameters:
list - The Collection to copy to the new array
Returns:
The new 'long' array

toDoubleArray

public static <N extends java.lang.Number> double[] toDoubleArray(java.util.Collection<N> list)
Creates a new 'double' array containing the elements in the specified 'Double' list

Parameters:
list - The Collection to copy to the new array
Returns:
The new 'double' array

toStringArray

public static java.lang.String[] toStringArray(java.lang.Object[] a)
Returns a String array comprised of toString() calls to the specified Object array

Parameters:
a - The Object array
Returns:
The String array (does not return null)

toStringArray

public static java.lang.String[] toStringArray(java.util.Collection<?> list)
Returns a String array comprised of toString() calls to the specified Collection of Objects

Parameters:
list - The Object Collection
Returns:
The String array (does not return null)

toSet

public static <T> java.util.Set<T> toSet(T... a)
Copies the specified Object array to a new Set

Parameters:
a - The array to copy to a new Set
Returns:
The Set (HashSet) containing the elements from the specified array

toSet

public static <T> java.util.Set<T> toSet(java.util.Set<T> set,
                                         T... a)
Copies the specified Object array to a new Set

Parameters:
set - The Set to which the array elements will be copied
a - The array to copy to the Set
Returns:
The Set containing the elements from the specified array

toSet

public static <T> java.util.Set<T> toSet(T[] a,
                                         java.util.Set<T> set)
Copies the specified Object array to a new Set

Parameters:
a - The array to copy to the Set
set - The Set to which the array elements will be copied
Returns:
The Set containing the elements from the specified array

toSet

public static <T> java.util.Set<T> toSet(T[] a,
                                         int ofs,
                                         int len,
                                         java.util.Set<T> set)
Copies the specified Object array to a new Set

Parameters:
a - The array to copy to the Set
ofs - The offset within 'a' to begin copying
len - The number of elements to copy to the new array
set - The Set to which the array elements will be copied
Returns:
The Set containing the elements from the specified array

toSet

public static <T> java.util.Set<T> toSet(java.util.Collection<T> c)
Copies the specified Collection to a new Set

Parameters:
c - The Collection to copy to the Set
Returns:
The Set containing the elements from the specified Collection

toSet

public static <T> java.util.Set<T> toSet(java.util.Collection<T> c,
                                         java.util.Set<T> set)
Copies the specified Collection to a new Set

Parameters:
c - The Collection to copy to the Set
set - The Set to which the Collection elements will be copied
Returns:
The Set containing the elements from the specified Collection

toMap

public 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

Parameters:
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.
Returns:
The Map (OrderedMap) created from the specified array

toMap

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)
Creates a new Map instance containing the elements from the specified array

Parameters:
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.
Returns:
The Map created from the specified array

toMap

public 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. The key for a given element is the value returned from the specified method on the array element.

Parameters:
keyMethod - The method name invoked on the array element to retrieve the element key.
arry - The array added to the map.
Returns:
A new OrderedMap instance containing the array elements

toMap

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)
Creates a Map instance containing the elements from the specified array. The key for a given element is the value returned from the specified method on the array element.

Parameters:
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.
Returns:
The Map instance containing the array elements

add

public static <T> java.util.List<T> add(java.util.List<T> list,
                                        T obj)
Adds the specified Object to the specified List

Parameters:
list - The List to which the specified object will be added
obj - The Object to add to the specified List
Returns:
The 'list' instance to which the object was added

add

public static <T> T[] add(T[] list,
                          T obj)
Creates a new array with the specified object appended to the end of the specified array

Parameters:
list - The array to which the object will be appended
obj - The object to append to the specified array
Returns:
The new Object array to which the specified object instance was appended

add

public static int[] add(int[] list,
                        int obj)
Creates a new array with the specified object appended to the end of the specified array

Parameters:
list - The array to which the object will be appended
obj - The object to append to the specified array
Returns:
The new Object array to which the specified object instance was appended

add

public static long[] add(long[] list,
                         long obj)
Creates a new array with the specified object appended to the end of the specified array

Parameters:
list - The array to which the object will be appended
obj - The object to append to the specified array
Returns:
The new Object array to which the specified object instance was appended

add

public static double[] add(double[] list,
                           double obj)
Creates a new array with the specified object appended to the end of the specified array

Parameters:
list - The array to which the object will be appended
obj - The object to append to the specified array
Returns:
The new Object array to which the specified object instance was appended

joinArrays

public static <T> T[] joinArrays(T[] a1,
                                 T[] a2,
                                 T[] a3,
                                 T[] a4)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
a3 - The 3rd array
a4 - The 4th array
Returns:
The combined/joind array

joinArrays

public static <T> T[] joinArrays(T[] a1,
                                 T[] a2,
                                 T[] a3)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
a3 - The 3rd array
Returns:
The combined/joind array

joinArrays

public static <T> T[] joinArrays(T[] a1,
                                 T[] a2)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
Returns:
The combined/joind array

joinArrays

public static double[] joinArrays(double[] a1,
                                  double[] a2,
                                  double[] a3,
                                  double[] a4)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
a3 - The 3rd array
a4 - The 4th array
Returns:
The combined/joind array

joinArrays

public static double[] joinArrays(double[] a1,
                                  double[] a2,
                                  double[] a3)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
a3 - The 3rd array
Returns:
The combined/joind array

joinArrays

public static double[] joinArrays(double[] a1,
                                  double[] a2)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
Returns:
The combined/joind array

joinArrays

public static long[] joinArrays(long[] a1,
                                long[] a2,
                                long[] a3,
                                long[] a4)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
a3 - The 3rd array
a4 - The 4th array
Returns:
The combined/joind array

joinArrays

public static long[] joinArrays(long[] a1,
                                long[] a2,
                                long[] a3)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
a3 - The 3rd array
Returns:
The combined/joind array

joinArrays

public static long[] joinArrays(long[] a1,
                                long[] a2)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
Returns:
The combined/joind array

joinArrays

public static int[] joinArrays(int[] a1,
                               int[] a2,
                               int[] a3,
                               int[] a4)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
a3 - The 3rd array
a4 - The 4th array
Returns:
The combined/joind array

joinArrays

public static int[] joinArrays(int[] a1,
                               int[] a2,
                               int[] a3)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
a3 - The 3rd array
Returns:
The combined/joind array

joinArrays

public static int[] joinArrays(int[] a1,
                               int[] a2)
Joins the specified arrays into a single array

Parameters:
a1 - The 1st array
a2 - The 2nd array
Returns:
The combined/joind array

insert

public static <T> java.util.List<T> insert(java.util.List<T> list,
                                           T obj,
                                           int ndx)
Inserts the specified Object to the specified List, at the specified location

Parameters:
list - The List to which the specified object will be inserted
obj - The Object to insert into the specified List
ndx - The location in the List instance where the object will be inserted
Returns:
The list instance to which the object was inserted

insert

public static <T> T[] insert(T[] list,
                             T obj,
                             int index)
Creates a new array with the specified object inserted into specified array

Parameters:
list - The array to which the object will be inserted
obj - The object to insert into the specified array
index - The location where the object will be inserted
Returns:
The new Object array to which the specified object instance was inserted

insert

public static int[] insert(int[] list,
                           int obj,
                           int index)
Creates a new array with the specified object inserted into specified array

Parameters:
list - The array to which the object will be inserted
obj - The object to insert into the specified array
index - The location where the object will be inserted
Returns:
The new Object array to which the specified object instance was inserted

insert

public static long[] insert(long[] list,
                            long obj,
                            int index)
Creates a new array with the specified object inserted into specified array

Parameters:
list - The array to which the object will be inserted
obj - The object to insert into the specified array
index - The location where the object will be inserted
Returns:
The new Object array to which the specified object instance was inserted

insert

public static double[] insert(double[] list,
                              double obj,
                              int index)
Creates a new array with the specified object inserted into specified array

Parameters:
list - The array to which the object will be inserted
obj - The object to insert into the specified array
index - The location where the object will be inserted
Returns:
The new Object array to which the specified object instance was inserted

remove

public static <T> java.util.List<T> remove(java.util.List<T> list,
                                           int ndx)
Removes the element at the specified index from the specified List

Parameters:
list - The List from which the element at the specified index will be removed
ndx - The index of the element to remove from the specified List
Returns:
The list instance from which the element was removed

remove

public static <T> T[] remove(T[] list,
                             int ndx)
Removes the element at the specified index from the specified array

Parameters:
list - The array from which the element will be removed
ndx - The index of the element to remove from the specified array
Returns:
The new Object array from which the specified element was removed

remove

public static int[] remove(int[] list,
                           int ndx)
Removes the element at the specified index from the specified array

Parameters:
list - The array from which the element will be removed
ndx - The index of the element to remove from the specified array
Returns:
The new Object array from which the specified element was removed

remove

public static long[] remove(long[] list,
                            int ndx)
Removes the element at the specified index from the specified array

Parameters:
list - The array from which the element will be removed
ndx - The index of the element to remove from the specified array
Returns:
The new Object array from which the specified element was removed

remove

public static double[] remove(double[] list,
                              int ndx)
Removes the element at the specified index from the specified array

Parameters:
list - The array from which the element will be removed
ndx - The index of the element to remove from the specified array
Returns:
The new Object array from which the specified element was removed

toIterator

public static <T> java.util.Iterator<T> toIterator(java.lang.Iterable<T> i)
Returns an Iterator for the specified Iterable

Parameters:
i - The Iterable
Returns:
An Iterator for the specified Iterable

toIterator

public static <T> java.util.Iterator<T> toIterator(java.util.Enumeration<T> e)
Converts the specified Enumeration into an Iterator

Parameters:
e - The Enumeration
Returns:
An Iterator for the specified Enumeration

toIterator

public static <T> java.util.Iterator<T> toIterator(T[] list)
Returns an iterator over the elements in the specified array

Parameters:
list - The array
Returns:
An Iterator over the elements in the specified array

sort

public static <T> java.util.List<T> sort(java.util.List<T> list,
                                         java.util.Comparator<? super T> comp)
Sorts the specified List based on the specified Comparator

Parameters:
list - The list to sort (in-place)
comp - The Comparator used to sort the specified List
Returns:
The sorted List (in-place)

sort

public static <T> java.util.List<T> 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

Parameters:
list - The list to sort (in-place)
comp - The Comparator used to sort the specified List
forwardOrder - True to sort based on the Comparator, false to sort based on the reverse order of the Comparator
Returns:
The sorted List (in-place)

sort

public static <T> T[] sort(T[] list,
                           java.util.Comparator<? super T> comp)
Sorts the specified array based on the specified Comparator

Parameters:
list - The array to sort (in-place)
comp - The Comparator used to sort the specified array
Returns:
The sorted array (in-place)

sort

public static <T> T[] sort(T[] list,
                           java.util.Comparator<? super T> comp,
                           boolean forwardOrder)
Sorts the specified array based on the specified Comparator

Parameters:
list - The array to sort (in-place)
comp - The Comparator used to sort the specified array
forwardOrder - True to sort based on the Comparator, false to sort based on the reverse order of the Comparator
Returns:
The sorted array (in-place)

sort

public static java.lang.String[] sort(java.lang.String[] list)
Sorts the specified String array in ascending order

Parameters:
list - The array to sort (in-place)
Returns:
The sorted array (in-place)

sort

public static java.lang.String[] sort(java.lang.String[] list,
                                      boolean forwardOrder)
Sorts the specified String array

Parameters:
list - The array to sort (in-place)
forwardOrder - True to sort ascending, false descending
Returns:
The sorted array (in-place)

compare

public static int compare(java.lang.Number n1,
                          java.lang.Number n2)
Compare compare 2 Numbers


compare

public static int compare(java.lang.Number n1,
                          java.lang.Number n2,
                          boolean ascending)
Compare compare 2 Numbers


reverseOrder

public static <T> T[] reverseOrder(T[] list)
Reverses the order of the elements in the specified array (in-place)

Parameters:
list - The array in which to reverse the order of elements (in-place)
Returns:
The array with the element order reversed (in-place)

reverseOrder

public static <T> java.util.List<T> reverseOrder(java.util.List<T> list)
Reverses the order of the elements in the specified List (in-place)

Parameters:
list - The List in which to reverse the order of elements (in-place)
Returns:
The List with the element order reversed (in-place)

swap

public static <T> void swap(java.util.List<T> list,
                            int x,
                            int y)
Swap 2 items in the specified list

Parameters:
list - The list
x - The first index
y - The second index

randomSwap

public static <T> void randomSwap(java.util.List<T> list,
                                  int x,
                                  java.util.Random r)
Swap an item in the specified list with another random item

Parameters:
list - The list
x - The first index
r - Random instance used to generate random index

swap

public static <T> void swap(T[] list,
                            int x,
                            int y)
Swap 2 items in the specified list

Parameters:
list - The list
x - The first index
y - The second index

randomSwap

public static <T> void randomSwap(T[] list,
                                  int x,
                                  java.util.Random r)
Swap an item in the specified list with another random item

Parameters:
list - The list
x - The first index
r - Random instance used to generate random index

swap

public static void swap(char[] list,
                        int x,
                        int y)
Swap 2 items in the specified list

Parameters:
list - The list
x - The first index
y - The second index

randomSwap

public static void randomSwap(char[] list,
                              int x,
                              java.util.Random r)
Swap an item in the specified list with another random item

Parameters:
list - The list
x - The first index
r - Random instance used to generate random index

swap

public static void swap(byte[] list,
                        int x,
                        int y)
Swap 2 items in the specified list

Parameters:
list - The list
x - The first index
y - The second index

randomSwap

public static void randomSwap(byte[] list,
                              int x,
                              java.util.Random r)
Swap an item in the specified list with another random item

Parameters:
list - The list
x - The first index
r - Random instance used to generate random index

swap

public static void swap(int[] list,
                        int x,
                        int y)
Swap 2 items in the specified list

Parameters:
list - The list
x - The first index
y - The second index

randomSwap

public static void randomSwap(int[] list,
                              int x,
                              java.util.Random r)
Swap an item in the specified list with another random item

Parameters:
list - The list
x - The first index
r - Random instance used to generate random index

swap

public static void swap(long[] list,
                        int x,
                        int y)
Swap 2 items in the specified list

Parameters:
list - The list
x - The first index
y - The second index

randomSwap

public static void randomSwap(long[] list,
                              int x,
                              java.util.Random r)
Swap an item in the specified list with another random item

Parameters:
list - The list
x - The first index
r - Random instance used to generate random index

swap

public static void swap(double[] list,
                        int x,
                        int y)
Swap 2 items in the specified list

Parameters:
list - The list
x - The first index
y - The second index

randomSwap

public static void randomSwap(double[] list,
                              int x,
                              java.util.Random r)
Swap an item in the specified list with another random item

Parameters:
list - The list
x - The first index
r - Random instance used to generate random index

shuffle

public static <T> T[] shuffle(T[] list,
                              java.math.BigInteger bigSeed)
Shuffle the array (in place) based on the specified randomizer seed

Parameters:
list - The list to shuffle
bigSeed - The randomizer seed
Returns:
The shuffled array

shuffle

public static <T> T[] shuffle(T[] list,
                              long seed)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
seed - The randomizer seed
Returns:
The shuffled array

shuffle

public static <T> T[] shuffle(T[] list,
                              java.util.Random rand)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
rand - The randomizer
Returns:
The shuffled array

shuffle

public static char[] shuffle(char[] list,
                             java.math.BigInteger bigSeed)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
bigSeed - The randomizer seed
Returns:
The shuffled array

shuffle

public static char[] shuffle(char[] list,
                             long seed)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
seed - The randomizer seed
Returns:
The shuffled array

shuffle

public static char[] shuffle(char[] list,
                             java.util.Random rand)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
rand - The randomizer
Returns:
The shuffled array

shuffle

public static java.lang.String shuffle(java.lang.String list,
                                       java.math.BigInteger bigSeed)
Shuffle the String based on the specified randomizer

Parameters:
list - The String to shuffle
bigSeed - The randomizer seed
Returns:
The shuffled String

shuffle

public static java.lang.String shuffle(java.lang.String list,
                                       long seed)
Shuffle the String based on the specified randomizer

Parameters:
list - The String to shuffle
seed - The randomizer seed
Returns:
The shuffled String

shuffle

public static java.lang.String shuffle(java.lang.String list,
                                       java.util.Random rand)
Shuffle the String based on the specified randomizer

Parameters:
list - The String to shuffle
rand - The randomizer
Returns:
The shuffled String

shuffle

public static byte[] shuffle(byte[] list,
                             java.math.BigInteger bigSeed)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
bigSeed - The randomizer seed
Returns:
The shuffled array

shuffle

public static byte[] shuffle(byte[] list,
                             long seed)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
seed - The randomizer seed
Returns:
The shuffled array

shuffle

public static byte[] shuffle(byte[] list,
                             java.util.Random rand)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
rand - The randomizer
Returns:
The shuffled array

shuffle

public static int[] shuffle(int[] list,
                            java.math.BigInteger bigSeed)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
bigSeed - The randomizer seed
Returns:
The shuffled array

shuffle

public static int[] shuffle(int[] list,
                            long seed)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
seed - The randomizer seed
Returns:
The shuffled array

shuffle

public static int[] shuffle(int[] list,
                            java.util.Random rand)
Shuffle the array (in place) based on the specified randomizer

Parameters:
list - The list to shuffle
rand - The randomizer
Returns:
The shuffled array

getBoolean

public 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

Parameters:
map - The map from which the value is retrieved
key - The key for which the value is retrieved
dft - The default value if the key is not present in the map
remove - True to remove the key from the map
Returns:
The retrieve boolean value

getShort

public 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

Parameters:
map - The map from which the value is retrieved
key - The key for which the value is retrieved
dft - The default value if the key is not present in the map
remove - True to remove the key from the map
Returns:
The retrieve boolean value

getInt

public 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

Parameters:
map - The map from which the value is retrieved
key - The key for which the value is retrieved
dft - The default value if the key is not present in the map
remove - True to remove the key from the map
Returns:
The retrieve boolean value

getLong

public 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

Parameters:
map - The map from which the value is retrieved
key - The key for which the value is retrieved
dft - The default value if the key is not present in the map
remove - True to remove the key from the map
Returns:
The retrieve boolean value

getDouble

public 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

Parameters:
map - The map from which the value is retrieved
key - The key for which the value is retrieved
dft - The default value if the key is not present in the map
remove - True to remove the key from the map
Returns:
The retrieve boolean value

getString

public 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

Parameters:
map - The map from which the value is retrieved
key - The key for which the value is retrieved
dft - The default value if the key is not present in the map
remove - True to remove the key from the map
Returns:
The retrieve boolean value

main

public static void main(java.lang.String[] argv)
Main entry point for testing/debugging

Parameters:
argv - Comand-line arguments