|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.rhq.core.clientapi.util.ArrayUtil
public class ArrayUtil
| Constructor Summary | |
|---|---|
ArrayUtil()
|
|
| Method Summary | |
|---|---|
static double |
average(double[] values)
Get the average of an array of values. |
static Object[] |
combine(Object[] a1,
Object[] a2)
Combine two arrays into a single, larger array. |
static void |
dumpArray(PrintStream out,
Object[] array)
|
static boolean |
equals(Object[] a1,
Object[] a2)
Array equality |
static boolean |
exists(Object[] array,
Object element)
Return a boolean whether or not the element exists in the array |
static int |
find(Object[] array,
Object element)
Find the index of the first appearance of an object in the array |
static int |
findMinDiff(double[] values)
Find the 2 values with the smallest difference between them. |
static boolean |
isUniq(String[] values)
Check to see if a _sorted_ array of values contains all unique values. |
static int |
max(double[] values)
Find the maximum value in an array of double values. |
static int |
max(int[] values)
Find the maximum value in an array of int values. |
static Object[] |
merge(Object[][] arrays,
Object[] arrType)
|
static Object[] |
merge(Object[] one,
Object[] two,
Object[] arrType)
|
static int |
min(double[] values)
Find the minimum value in an array of double values. |
static int[] |
stringToInt(String[] array)
Convert a string array to an array of int. |
static Integer[] |
stringToInteger(String[] array)
Convert a string array to an array of Integer. |
static double[] |
uniq(double[] values)
Return an array of values where every value is unique. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayUtil()
| Method Detail |
|---|
public static void dumpArray(PrintStream out,
Object[] array)
public static Object[] merge(Object[][] arrays,
Object[] arrType)
public static Object[] merge(Object[] one,
Object[] two,
Object[] arrType)
public static int max(double[] values)
values - Values to search for to find the max of
public static int max(int[] values)
values - Values to search for to find the max of
public static int min(double[] values)
values - Values to search for to find the min of
public static double average(double[] values)
public static double[] uniq(double[] values)
values - Values to get the unique of. Note that this array _must_ be sorted, prior to invoking this method
public static boolean isUniq(String[] values)
public static boolean equals(Object[] a1,
Object[] a2)
public static int findMinDiff(double[] values)
values - An array of _sorted_, _unique_ values
public static boolean exists(Object[] array,
Object element)
array - An array of objectselement - The element to look for in the array
public static int find(Object[] array,
Object element)
public static Integer[] stringToInteger(String[] array)
array is null, null will be returned.
array - string array
NumberFormatException - if an element in the String array is not parseable into an Integerpublic static int[] stringToInt(String[] array)
array is null, null will be returned.
array - string array
NumberFormatException - if an element in the String array is not parseable into an int
public static Object[] combine(Object[] a1,
Object[] a2)
a1 - The first array. If this is null, a copy of the second array is returned (unless it's null too, then
null is returned).a2 - The second array. If this is null, a copy of the first array is returned (unless it's null too, then
null is returned).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||