org.apache.webbeans.util
Class ArrayUtil

java.lang.Object
  extended by org.apache.webbeans.util.ArrayUtil

public final class ArrayUtil
extends Object


Method Summary
static
<T> Set<T>
asSet(T... items)
           
static boolean equalsIgnorePosition(Object[] arr1, Object[] arr2)
          Compare two arrays regardless of the position of the elements in the arrays.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equalsIgnorePosition

public static boolean equalsIgnorePosition(Object[] arr1,
                                           Object[] arr2)
Compare two arrays regardless of the position of the elements in the arrays. The complex handling with temporary flags is necessary due to the possibility of having multiple occurrences of the same element in the arrays. In this case both arrays have to contain the exactly same amount of those elements. This is only suited for smaller arrays (e.g. count < 100) since the algorithm uses a product of both arrays. If one likes to use this for larger arrays, we'd have to use hashes.

Parameters:
arr1 -
arr2 -
Returns:

asSet

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


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.