net.sourceforge.pmd.util
public class CollectionUtil extends Object
Version: $Revision$
Field Summary | |
---|---|
static TypeMap | collectionClassesByNames |
static TypeMap | collectionInterfacesByNames |
Method Summary | |
---|---|
static boolean | areEqual(Object value, Object otherValue)
A comprehensive isEqual method that handles nulls and arrays safely.
|
static boolean | arraysAreEqual(Object value, Object otherValue)
Returns true if the objects are array instances and each of their elements compares
via equals as well.
|
static <T> Set<T> | asSet(T[] items)
Returns the items as a populated set.
|
static Class | getCollectionTypeFor(String shortName)
Returns the collection type if we recognize it by its short name.
|
static <K,V> Map<V,K> | invertedMapFrom(Map<K,V> source)
Returns a map based on the source but with the key & values swapped.
|
static boolean | isCollectionType(String typeName, boolean includeInterfaces)
Return whether we can identify the typeName as a java.util collection class
or interface as specified.
|
static boolean | isCollectionType(Class clazzType, boolean includeInterfaces)
Return whether we can identify the typeName as a java.util collection class
or interface as specified.
|
static <K,V> Map<K,V> | mapFrom(K[] keys, V[] values)
Creates and returns a map populated with the keyValuesSets where
the value held by the tuples are they key and value in that order.
|
static boolean | valuesAreTransitivelyEqual(Object[] thisArray, Object[] thatArray)
Returns whether the arrays are equal by examining each of their elements, even if they are
arrays themselves.
|
Parameters: value Object otherValue Object
Returns: boolean
Parameters: value Object otherValue Object
Returns: boolean
Parameters: items Object[]
Returns: Set
Parameters: shortName String
Returns: Class
Parameters: source Map
Returns: Map
Parameters: typeName String includeInterfaces boolean
Returns: boolean
Parameters: clazzType Class includeInterfaces boolean
Returns: boolean
Parameters: keys K[] values V[]
Returns: Map
Parameters: thisArray Object[] thatArray Object[]
Returns: boolean