org.dmonix.util
Class ArrayHandler

java.lang.Object
  extended byorg.dmonix.util.ArrayHandler

public class ArrayHandler
extends java.lang.Object

Title: ArrayHandler Description: The class provides functions for different operations on arrays Copyright: Copyright (c) Company:

Version:
1.0
Author:
Peter Nerg

Field Summary
static int ASCENDING
           
static int DESCENDING
           
 
Constructor Summary
ArrayHandler()
           
 
Method Summary
static byte[] addElement(byte[] array, byte element)
          Add an item to the end of the supplied array
static int[] addElement(int[] array, int element)
          Add an item to the end of the supplied array
static java.lang.String[] addElement(java.lang.String[] array, java.lang.String element)
          Add an item to the end of the supplied array
static byte[] addElementAt(byte[] array, byte element, int index)
          Add an item at the specific index of the supplied array
static int[] addElementAt(int[] array, int element, int index)
          Add an item at the specific index of the supplied array
static java.lang.String[] addElementAt(java.lang.String[] array, java.lang.String element, int index)
          Add an item at the specific index of the supplied array
static int[] indexOf(byte[] array, byte element)
          Search the array for matching elements
static int[] indexOf(int[] array, int element)
          Search the array for matching elements
static int[] indexOf(java.lang.String[] array, java.lang.String element)
          Search the array for matching elements
static byte[] removeElement(byte[] array, byte element)
          Remove all elements matching the supplied element
static int[] removeElement(int[] array, int element)
          Remove all elements matching the supplied element
static java.lang.String[] removeElement(java.lang.String[] array, java.lang.String element)
          Remove all elements matching the supplied element
static byte[] removeElementAt(byte[] array, int index)
          Remove an element from the supplied array at the specific index
static int[] removeElementAt(int[] array, int index)
          Remove an element from the supplied array at the specific index
static java.lang.String[] removeElementAt(java.lang.String[] array, int index)
          Remove an element from the supplied array at the specific index
static byte[] sort(byte[] array, int sort)
          Sorts the array
static int[] sort(int[] array, int sort)
          Sorts the array
static java.lang.String[] sort(java.lang.String[] array, int sort)
          Sorts the array
static byte[] trimToSize(byte[] array, int size)
          Trims the capacity of this array to be the given size
static int[] trimToSize(int[] array, int size)
          Trims the capacity of this array to be the given size
static java.lang.String[] trimToSize(java.lang.String[] array, int size)
          Trims the capacity of this array to be the given size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ASCENDING

public static final int ASCENDING
See Also:
Constant Field Values

DESCENDING

public static final int DESCENDING
See Also:
Constant Field Values
Constructor Detail

ArrayHandler

public ArrayHandler()
Method Detail

addElement

public static byte[] addElement(byte[] array,
                                byte element)
Add an item to the end of the supplied array

Parameters:
array - The array from which to add the element
element - The element to add
Returns:
byte[]

addElement

public static int[] addElement(int[] array,
                               int element)
Add an item to the end of the supplied array

Parameters:
array - The array from which to add the element
element - The element to add
Returns:
int[]

addElement

public static java.lang.String[] addElement(java.lang.String[] array,
                                            java.lang.String element)
Add an item to the end of the supplied array

Parameters:
array - The array from which to add the element
element - The element to add
Returns:
String[]

addElementAt

public static byte[] addElementAt(byte[] array,
                                  byte element,
                                  int index)
Add an item at the specific index of the supplied array

Parameters:
array - The array from which to add the element
element - The element to add
index - The index from which to add the element
Returns:
byte[]

addElementAt

public static int[] addElementAt(int[] array,
                                 int element,
                                 int index)
Add an item at the specific index of the supplied array

Parameters:
array - The array from which to add the element
element - The element to add
index - The index from which to add the element
Returns:
int[]

addElementAt

public static java.lang.String[] addElementAt(java.lang.String[] array,
                                              java.lang.String element,
                                              int index)
Add an item at the specific index of the supplied array

Parameters:
array - The array from which to add the element
element - The element to add
index - The index from which to add the element
Returns:
String[]

indexOf

public static int[] indexOf(byte[] array,
                            byte element)
Search the array for matching elements

Parameters:
array - The array from which to search for the element
element - The element to search for
Returns:
int[]

indexOf

public static int[] indexOf(int[] array,
                            int element)
Search the array for matching elements

Parameters:
array - The array from which to search for the element
element - The element to search for
Returns:
int[]

indexOf

public static int[] indexOf(java.lang.String[] array,
                            java.lang.String element)
Search the array for matching elements

Parameters:
array - The array from which to search for the element
element - The element to search for
Returns:
int[]

removeElement

public static byte[] removeElement(byte[] array,
                                   byte element)
Remove all elements matching the supplied element

Parameters:
array - The array from which to remove the element(s)
element - The element to remove from the array
Returns:
byte[]

removeElement

public static int[] removeElement(int[] array,
                                  int element)
Remove all elements matching the supplied element

Parameters:
array - The array from which to remove the element(s)
element - The element to remove from the array
Returns:
int[]

removeElement

public static java.lang.String[] removeElement(java.lang.String[] array,
                                               java.lang.String element)
Remove all elements matching the supplied element

Parameters:
array - The array from which to remove the element(s)
element - The element to remove from the array
Returns:
String[]

removeElementAt

public static byte[] removeElementAt(byte[] array,
                                     int index)
Remove an element from the supplied array at the specific index

Parameters:
array - The array from which to remove the element
index - The index from which to remove the element
Returns:
byte[]

removeElementAt

public static int[] removeElementAt(int[] array,
                                    int index)
Remove an element from the supplied array at the specific index

Parameters:
array - The array from which to remove the element
index - The index from which to remove the element
Returns:
int[]

removeElementAt

public static java.lang.String[] removeElementAt(java.lang.String[] array,
                                                 int index)
Remove an element from the supplied array at the specific index

Parameters:
array - The array from which to remove the element
index - The index from which to remove the element
Returns:
String[]

sort

public static byte[] sort(byte[] array,
                          int sort)
Sorts the array

Parameters:
array - The array to sort
sort - Ascending/descending
Returns:
byte[]

sort

public static int[] sort(int[] array,
                         int sort)
Sorts the array

Parameters:
array - The array to sort
sort - Ascending/descending
Returns:
int[]

sort

public static java.lang.String[] sort(java.lang.String[] array,
                                      int sort)
Sorts the array

Parameters:
array - The array to sort
sort - Ascending/descending
Returns:
String[]

trimToSize

public static byte[] trimToSize(byte[] array,
                                int size)
Trims the capacity of this array to be the given size

Parameters:
array - The array from which to remove the element
size - The size to trim to
Returns:
byte[]

trimToSize

public static int[] trimToSize(int[] array,
                               int size)
Trims the capacity of this array to be the given size

Parameters:
array - The array from which to remove the element
size - The size to trim to
Returns:
int[]

trimToSize

public static java.lang.String[] trimToSize(java.lang.String[] array,
                                            int size)
Trims the capacity of this array to be the given size

Parameters:
array - The array from which to remove the element
size - The size to trim to
Returns:
String[]


Copyright © 1998-2005 dmonix.org Peter Nerg, All Rights Reserved.