|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.pmd.util.CollectionUtil
public class CollectionUtil
Generic collection and array-related utility functions.
| Field Summary | |
|---|---|
static TypeMap |
collectionClassesByNames
|
static TypeMap |
collectionInterfacesByNames
|
| Method Summary | ||
|---|---|---|
static boolean |
areEqual(java.lang.Object value,
java.lang.Object otherValue)
A comprehensive isEqual method that handles nulls and arrays safely. |
|
static boolean |
arraysAreEqual(java.lang.Object value,
java.lang.Object otherValue)
Returns true if the objects are array instances and each of their elements compares via equals as well. |
|
static
|
asSet(T[] items)
Returns the items as a populated set. |
|
static java.lang.Class |
getCollectionTypeFor(java.lang.String shortName)
Returns the collection type if we recognize it by its short name. |
|
static
|
invertedMapFrom(java.util.Map<K,V> source)
Returns a map based on the source but with the key & values swapped. |
|
static boolean |
isCollectionType(java.lang.Class clazzType,
boolean includeInterfaces)
Return whether we can identify the typeName as a java.util collection class or interface as specified. |
|
static boolean |
isCollectionType(java.lang.String typeName,
boolean includeInterfaces)
Return whether we can identify the typeName as a java.util collection class or interface as specified. |
|
static
|
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(java.lang.Object[] thisArray,
java.lang.Object[] thatArray)
Returns whether the arrays are equal by examining each of their elements, even if they are arrays themselves. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final TypeMap collectionInterfacesByNames
public static final TypeMap collectionClassesByNames
| Method Detail |
|---|
public static java.lang.Class getCollectionTypeFor(java.lang.String shortName)
shortName - String
public static boolean isCollectionType(java.lang.String typeName,
boolean includeInterfaces)
typeName - StringincludeInterfaces - boolean
public static boolean isCollectionType(java.lang.Class clazzType,
boolean includeInterfaces)
clazzType - ClassincludeInterfaces - boolean
public static <T> java.util.Set<T> asSet(T[] items)
items - Object[]
public static <K,V> java.util.Map<K,V> mapFrom(K[] keys,
V[] values)
keys - K[]values - V[]
public static <K,V> java.util.Map<V,K> invertedMapFrom(java.util.Map<K,V> source)
source - Map
public static final boolean arraysAreEqual(java.lang.Object value,
java.lang.Object otherValue)
value - ObjectotherValue - Object
public static final boolean valuesAreTransitivelyEqual(java.lang.Object[] thisArray,
java.lang.Object[] thatArray)
thisArray - Object[]thatArray - Object[]
public static final boolean areEqual(java.lang.Object value,
java.lang.Object otherValue)
value - ObjectotherValue - Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||