public class SetUtil
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isEmpty(java.lang.Object obj)
Returns true if obj is not a Collection (including if obj ==
null) or if obj is an empty Collection.
|
static java.lang.String |
plistMatch(java.util.List<java.lang.String> plist,
java.lang.String key)
Returns the first String value indexed by a String regex matching
key in the property list plist, else returns an empty String
if no regex in plist matches key.
|
static void |
removeByPattern(java.util.List seq,
java.lang.String regex)
Filters the List of Strings seq, removing all items that match
the regular expression pattern regex.
|
static void |
removeDuplicates(java.util.Collection collection)
Removes duplicates from collection based on its natural
comparator or equality operator.
|
static void |
retainByPattern(java.util.List seq,
java.lang.String regex)
Filters the List of Strings seq, retaining only items that match
the regular expression pattern regex.
|
public static void removeDuplicates(java.util.Collection collection)
collection
- The collection from which duplicate elements
are to be removed.public static boolean isEmpty(java.lang.Object obj)
obj
- The Object to be tested, presumably with the
expectation that it could be a Collectionpublic static java.lang.String plistMatch(java.util.List<java.lang.String> plist, java.lang.String key)
plist
- A property list (cf. LISP) containing an even
number of Strings, which are understood to be consecutive
regex/value pairskey
- A String that will be matched against the regular
expressions in plist.public static void removeByPattern(java.util.List seq, java.lang.String regex)
seq
- A List of Stringsregex
- A regular expression pattern String that will be
matched against the Strings in seqpublic static void retainByPattern(java.util.List seq, java.lang.String regex)
seq
- A List of Stringsregex
- A regular expression pattern String that will be
matched against the Strings in seq