org.jboss.weld.util.collections
Class Arrays2

java.lang.Object
  extended by org.jboss.weld.util.collections.Arrays2

public class Arrays2
extends Object

Author:
pmuir

Method Summary
static
<T> Set<T>
asSet(T... array)
           
static boolean containsAll(Object[] array, Object... values)
           
static
<T> T[]
copyOf(T[] original, int newLength)
          Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.
static
<T,U> T[]
copyOf(U[] original, int newLength, Class<? extends T[]> newType)
          Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length.
static boolean unorderedEquals(Object[] array, Object... values)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

containsAll

public static final boolean containsAll(Object[] array,
                                        Object... values)

unorderedEquals

public static final boolean unorderedEquals(Object[] array,
                                            Object... values)

asSet

public static <T> Set<T> asSet(T... array)

copyOf

public static <T> T[] copyOf(T[] original,
                             int newLength)
Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain null. Such indices will exist if and only if the specified length is greater than that of the original array. The resulting array is of exactly the same class as the original array.

Parameters:
original - the array to be copied
newLength - the length of the copy to be returned
Returns:
a copy of the original array, truncated or padded with nulls to obtain the specified length
Throws:
NegativeArraySizeException - if newLength is negative
NullPointerException - if original is null
Since:
1.6

copyOf

public static <T,U> T[] copyOf(U[] original,
                               int newLength,
                               Class<? extends T[]> newType)
Copies the specified array, truncating or padding with nulls (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain null. Such indices will exist if and only if the specified length is greater than that of the original array. The resulting array is of the class newType.

Parameters:
original - the array to be copied
newLength - the length of the copy to be returned
newType - the class of the copy to be returned
Returns:
a copy of the original array, truncated or padded with nulls to obtain the specified length
Throws:
NegativeArraySizeException - if newLength is negative
NullPointerException - if original is null
ArrayStoreException - if an element copied from original is not of a runtime type that can be stored in an array of class newType
Since:
1.6


Copyright © 2013 Seam Framework. All Rights Reserved.