com.dyuproject.util
Class ArrayUtil

java.lang.Object
  extended by com.dyuproject.util.ArrayUtil

public final class ArrayUtil
extends Object

Author:
David Yu
Date created:
Jan 16, 2009

Constructor Summary
ArrayUtil()
           
 
Method Summary
static
<T> T[]
append(T[] oldArray, T toAppend)
          Copies the elements of the oldArray to a new array with extra space to append the given element toAppend.
static
<T> T[]
append(T[] oldArray, T[] toAppend)
          Copies the elements of the oldArray to a new array with extra space to append the given array toAppend.
static
<T> T[]
append(T[] oldArray, T[] toAppend1, T toAppend2)
          Copies the elements of the oldArray to a new array with extra space to append the given array toAppend1 and the element toAppend2.
static
<T> T[]
append(T[] oldArray, T[] toAppend1, T[] toAppend2)
          Copies the elements of the oldArray to a new array with extra space to append the given array toAppend1 and the array toAppend2.
static
<T> T[]
append(T[] oldArray, T toAppend1, T[] toAppend2)
          Copies the elements of the oldArray to a new array with extra space to append the given element toAppend1 and the array toAppend2.
static
<T> T[]
remove(T[] oldArray, int idx)
          Returns a copy of the old array oldArray but with the element at the give index idx removed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtil

public ArrayUtil()
Method Detail

append

public static <T> T[] append(T[] oldArray,
                             T toAppend)
Copies the elements of the oldArray to a new array with extra space to append the given element toAppend.


append

public static <T> T[] append(T[] oldArray,
                             T toAppend1,
                             T[] toAppend2)
Copies the elements of the oldArray to a new array with extra space to append the given element toAppend1 and the array toAppend2.


append

public static <T> T[] append(T[] oldArray,
                             T[] toAppend)
Copies the elements of the oldArray to a new array with extra space to append the given array toAppend.


append

public static <T> T[] append(T[] oldArray,
                             T[] toAppend1,
                             T toAppend2)
Copies the elements of the oldArray to a new array with extra space to append the given array toAppend1 and the element toAppend2.


append

public static <T> T[] append(T[] oldArray,
                             T[] toAppend1,
                             T[] toAppend2)
Copies the elements of the oldArray to a new array with extra space to append the given array toAppend1 and the array toAppend2.


remove

public static <T> T[] remove(T[] oldArray,
                             int idx)
Returns a copy of the old array oldArray but with the element at the give index idx removed.

Throws:
{@link - IllegalArgumentException} if the array index is out of bounds.


Copyright © 2008-2013. All Rights Reserved.