JAC project
AOPSYS
CEDRIC & LIP6 labs

org.objectweb.jac.util
Class ExtArrays

java.lang.Object
  |
  +--org.objectweb.jac.util.ExtArrays

public class ExtArrays
extends Object

Various often used array functions


Constructor Summary
ExtArrays()
           
 
Method Summary
static Object[] add(int position, Object toInsert, Object[] array)
          Insert an object into an array
static Object[] add(Object toAppend, Object[] array)
          Append an object at the end of an array
static boolean contains(Object[] array, Object value)
          Tells wether an array of objects contains a given value
static int indexOf(Object[] array, Object value)
          Returns the index of a value in an array of Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtArrays

public ExtArrays()
Method Detail

add

public static Object[] add(int position,
                           Object toInsert,
                           Object[] array)
Insert an object into an array

Parameters:
position - of the object to insert (>=0 and <=array.length)
toInsert - the object to insert
array - the array
Returns:
a new array of size array.length+1, where item at position "position" is toInsert

add

public static Object[] add(Object toAppend,
                           Object[] array)
Append an object at the end of an array

Parameters:
toAppend - the object to add
array - the array
Returns:
a new array, of length array.length+1 and whose last item is toAppend

indexOf

public static int indexOf(Object[] array,
                          Object value)
Returns the index of a value in an array of Object.

Parameters:
array - the array
value - the searched value
Returns:
Returns the lowest integer value i such that array[i]==value, or -1.

contains

public static boolean contains(Object[] array,
                               Object value)
Tells wether an array of objects contains a given value

Parameters:
array - the array to search the value in
value - the object to search for
Returns:
true if array contains value

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli