02/28/2005
 

com.epicentric.common
Class ArrayUtils

java.lang.Object
  |
  +--com.epicentric.common.ArrayUtils

Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced by class com.vignette.portal.util.ArrayUtils.

public class ArrayUtils
extends Object

Utility class providing a set of static methods to manipulate arrays.


Constructor Summary
ArrayUtils()
          Deprecated.  
 
Method Summary
static boolean[] addElement(boolean[] array, boolean value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static boolean[] addElement(boolean[] array, boolean value, int position)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int[] addElement(int[] array, int value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.addElement(int[],int)
static int[] addElement(int[] array, int value, int position)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.addElement(int[],int,int)
static String[] addElement(String[] array, String value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.addElement(String[],String).
static String[] addElement(String[] array, String value, int position)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static boolean arraysAreEqual(int[] a, int[] b)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int binarySearch(int[] array, int value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Use binarySearch methods in Arrays.
static boolean contains(int[] array, int value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.contains(int[],int)
static boolean contains(Object[] array, Object value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.contains(Object[],Object)
static Object[] getSubrange(Object[] array, int start, int end)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Use System.arraycopy(Object,int,Object,int,int).
static Vector getVector(Object[] array)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static boolean[] initializeArray(boolean[] array, boolean initialValue)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Use Arrays.fill(boolean[], boolean).
static int[] initializeArray(int[] array, int initialValue)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Use Arrays.fill(int[],int).
static int[] insertAndSort(int[] array, int value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int[] insertionSort(int[] a)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int[] intersectedArray(int[] a, int[] b)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.intersectedArray(int[],int[]).
static boolean intersects(int[] a, int[] b)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.intersects(int[],int[]).
static boolean intersects(int a, int[] b)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static boolean isEmpty(boolean[] array)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static boolean isEmpty(int[] array)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replace with ArrayUtils.isEmpty(int[]).
static boolean isEmpty(Object[] array)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replace with ArrayUtils.isEmpty(Object[]).
static boolean[] removeElementAt(boolean[] array, int index)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int[] removeElementAt(int[] array, int index)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int[] removeElementsOfValue(int[] array, int value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static String[] removeElementsOfValue(String[] array, String value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int[] removeLastElement(int[] array)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int[] removeValue(int[] array, int value)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.
static int[] setToIntArray(Set set)
          Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.setToIntArray(Set).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtils

public ArrayUtils()
Deprecated. 
Method Detail

contains

public static boolean contains(int[] array,
                               int value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.contains(int[],int)

Tests whether an integer array contains the given element
Parameters:
array - Name of the integer array
value - Array element to test for
Returns:
true if the array contains the element, or false if the array is null

contains

public static boolean contains(Object[] array,
                               Object value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.contains(Object[],Object)

Tests whether an array contains the given element, using Object.equals()
Parameters:
array - Name of the Object array
value - Array element to test for
Returns:
true if the array contains the element, or false if the array is null or not comparable

addElement

public static int[] addElement(int[] array,
                               int value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.addElement(int[],int)

Adds an element to the end of an integer array
Parameters:
array - Name of the integer array
value - Element to be added to the array
Returns:
Array with the new element, or if the array is null a new one-element array with the given value

addElement

public static int[] addElement(int[] array,
                               int value,
                               int position)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.addElement(int[],int,int)

Adds an element at the specified position in an integer array. If the position is greater than the length of the array, adds the element to the end of the array.
Parameters:
array - Name of the integer array
value - Element to be added to the array
position - New element's index
Returns:
Array with the new element, or if the array is null a new one-element array with the given value

addElement

public static boolean[] addElement(boolean[] array,
                                   boolean value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Adds an element to the end of a boolean array
Parameters:
array - Name of the boolean array
value - Element to be added to the array
Returns:
Array with the new element, or if the array is null a new one-element array with the given value

addElement

public static boolean[] addElement(boolean[] array,
                                   boolean value,
                                   int position)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Adds an element at the specified position in a boolean array. If the position is greater than the length of the array, adds the element to the end of the array.
Parameters:
array - Name of the boolean array
value - Element to be added to the array
position - New element's index
Returns:
Array with the new element, or if the array is null a new one-element array with the given value

addElement

public static String[] addElement(String[] array,
                                  String value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.addElement(String[],String).

Adds an element to the end of a String array
Parameters:
array - Name of the String array
value - Element to be added to the array
Returns:
Array with the new element, or if the array is null a new one-element array with the given value.

addElement

public static String[] addElement(String[] array,
                                  String value,
                                  int position)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Adds an element at the specified position in a String array. If the position is greater than the length of the array, adds the element to the end of the array.
Parameters:
array - Name of the String array
value - Element to be added to the array
position - New element's index
Returns:
Array with the new element, or if the array is null a new one-element array with the given value

removeLastElement

public static int[] removeLastElement(int[] array)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Removes the last element from an integer array. Modifies the input array: the return value and the input array are the same new array.
Parameters:
array - Name of the integer array
Returns:
Array with the element removed, or null if the array is null

removeElementAt

public static int[] removeElementAt(int[] array,
                                    int index)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Removes the element at the specified index and shrinks the array to size - 1
Parameters:
array - the array to be modified
index - the index of the element to be removed
Returns:
Array with the element removed, or null if the array is null

removeElementAt

public static boolean[] removeElementAt(boolean[] array,
                                        int index)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Removes the element at the specified index and shrinks the array to size - 1
Parameters:
array - the array to be modified
index - the index of the element to be removed
Returns:
Array with the element removed, or null if the array is null

removeElementsOfValue

public static int[] removeElementsOfValue(int[] array,
                                          int value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Removes all occurrences of the specified element in an integer array. Modifies the input array: the return value and the input array are the same new array.
Parameters:
array - Name of the integer array
value - Element(s) to be removed from the array
Returns:
Array with the element(s) removed, or null if the array is null

removeElementsOfValue

public static String[] removeElementsOfValue(String[] array,
                                             String value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Removes all occurrences of the specified element in a String array. If the element's value is null, removes null values from the array. Modifies the input array: the return value and the input array are the same new array.
Parameters:
array - Name of the integer array
value - Element(s) to be removed from the array
Returns:
Array with the element(s) removed, or null if the array is null

getSubrange

public static Object[] getSubrange(Object[] array,
                                   int start,
                                   int end)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Use System.arraycopy(Object,int,Object,int,int).

Copies the elements of an Object array from the specified starting position to the specified ending position, inclusive.
Parameters:
array - Name of the Object array
start - First element to be copied (starting the count from 0)
end - Last element to be copied (starting the count from 0)
Returns:
New array containing the copied elements

isEmpty

public static boolean isEmpty(Object[] array)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replace with ArrayUtils.isEmpty(Object[]).

Tests whether an Object array is empty
Parameters:
array - Name of the Object array
Returns:
true if the array is null or has 0 members

isEmpty

public static boolean isEmpty(int[] array)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replace with ArrayUtils.isEmpty(int[]).

Tests whether an integer array is empty
Parameters:
array - Name of the integer array
Returns:
true if the array is null or has 0 members

isEmpty

public static boolean isEmpty(boolean[] array)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Tests whether a boolean array is empty
Parameters:
array - Name of the boolean array
Returns:
true if the array is null or has 0 members

arraysAreEqual

public static boolean arraysAreEqual(int[] a,
                                     int[] b)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Tests whether two integer arrays are the same
Parameters:
a - Name of the first integer array
b - Name of the second integer array
Returns:
true if both arrays are the same

getVector

public static Vector getVector(Object[] array)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Converts an Object array into a Vector
Parameters:
array - Name of the Object array
Returns:
Vector containing the array's elements

insertAndSort

public static int[] insertAndSort(int[] array,
                                  int value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Inserts the specified element into an integer array, then sorts the elements. Requires a sorted array with no duplicate values.
Parameters:
array - Name of the integer array
value - Element to be inserted into the array
Returns:
Sorted array, or the original array if the array already contains the element

removeValue

public static int[] removeValue(int[] array,
                                int value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Removes an element with the given value from an integer array. Assumes that the array is sorted and that the value exists at most once.
Parameters:
array - Name of the integer array
value - Element to be removed from the array
Returns:
New array with the element removed, or the original array if the specified element does not exist

binarySearch

public static int binarySearch(int[] array,
                               int value)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Use binarySearch methods in Arrays.

Searches an integer array for the specified element using the binary search algorithm. Requires a sorted array with no duplicate values.
Parameters:
array - Name of the integer array
value - Element to be searched for
Returns:
Element's index, or -1 if the element is not found

intersects

public static boolean intersects(int[] a,
                                 int[] b)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.intersects(int[],int[]).

Tests whether two integer arrays have any matching elements. Assumes the arrays are sorted in ascending order.
Parameters:
a - First integer array
b - Second integer array
Returns:
true if there is at least one matching element

intersectedArray

public static int[] intersectedArray(int[] a,
                                     int[] b)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.intersectedArray(int[],int[]).

Return the intersection of two integer arrays, if they have any matching elements. The arrays MUST BE sorted in ascending order.
Parameters:
a - First integer array
b - Second integer array
Returns:
a new int array for the intersection

intersects

public static boolean intersects(int a,
                                 int[] b)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Tests whether an integer matches any elements in an integer array. Assumes the array is sorted in ascending order. Speedier than an unsorted search.
Parameters:
a - Integer to be matched
b - Integer array to be searched
Returns:
true if at least one element in the array matches the passed-in value

insertionSort

public static int[] insertionSort(int[] a)
Deprecated. As of version 4.5. To be removed in 8.0 or later. No replacement.

Sorts an integer array with the insertion sort algorithm -- a very fast sort for almost-sorted data
Parameters:
a - Integer array to be sorted
Returns:
Sorted array

setToIntArray

public static int[] setToIntArray(Set set)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Replaced with ArrayUtils.setToIntArray(Set).

Converts a Set of Integer objects into an array of ints - no order is implied or maintained. Returns null if the input set was null or if it contained any non-Integer objects.

initializeArray

public static boolean[] initializeArray(boolean[] array,
                                        boolean initialValue)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Use Arrays.fill(boolean[], boolean).

Initializes all the elements of a boolean array to the given initial value and returns the initialized array. If array is null, null is returned.
Parameters:
array - The boolean array to be initialized
initialValue - The value to assign to each element of the input array.

initializeArray

public static int[] initializeArray(int[] array,
                                    int initialValue)
Deprecated. As of version 4.5. To be removed in 8.0 or later. Use Arrays.fill(int[],int).

Initializes all the elements of an int array to the given initial value and returns the initialized array. If array is null, null is returned.
Parameters:
array - The int array to be initialized
initialValue - The value to assign to each element of the input array

02/28/2005
 

Copyright and Trademark Notices