| java.lang.Object com.ibm.icu.impl.CollectionUtilities
CollectionUtilities | final public class CollectionUtilities (Code) | | Utilities that ought to be on collections, but aren't
|
Inner Class :public interface ObjectMatcher | |
Inner Class :public static class InverseMatcher implements ObjectMatcher | |
Inner Class :public static class MultiComparator implements Comparator | |
Inner Class :abstract public static class FilteredIterator implements Iterator | |
Inner Class :public static class PrefixIterator extends FilteredIterator | |
Inner Class :public static class RegexIterator extends FilteredIterator | |
Method Summary | |
public static Collection | addAll(Iterator source, Collection target) | public static Map | asMap(Object[][] source, Map target, boolean reverse) | public static Map | asMap(Object[][] source) | public static boolean | containsAll(Collection a, Collection b) | public static boolean | containsNone(Collection a, Collection b) | public static boolean | containsSome(Collection a, Collection b) | public static UnicodeSet | flatten(UnicodeSet exemplar1) Modifies Unicode set to flatten the strings. | public static Object | getBest(Collection c, Comparator comp, int direction) | public static int | getContainmentRelation(Collection a, Collection b) | public Object | getFirst(Collection c) | public static String | join(Object[] array, String separator) | public static String | join(Collection collection, String separator) | public static int | matchesAt(CharSequence text, int offset, CharSequence other) | public static String | prettyPrint(UnicodeSet uset, boolean compressRanges, UnicodeSet toQuote, Transliterator quoter, Comparator ordering, Comparator spaceComparator) | public static String | remove(String source, UnicodeSet removals) | public static Map | removeAll(Map m, Collection itemsToRemove) | public static Collection | removeAll(Collection c, ObjectMatcher f) | public static Collection | retainAll(Collection c, ObjectMatcher f) | public static int | size(Iterator source) | public int | span(CharSequence string, int offset, UnicodeSet testSet) | public int | spanNot(CharSequence string, int offset, UnicodeSet testSet) |
ALL_EMPTYNOT_A_SUPERSET_BNOT_A_DISJOINT_BNOT_A_SUBSET_BNOT_A_EQUALS_BA_PROPER_SUBSET_OF_BA_PROPER_SUPERSET_BA_PROPER_OVERLAPS_B | final public static int ALL_EMPTYNOT_A_SUPERSET_BNOT_A_DISJOINT_BNOT_A_SUBSET_BNOT_A_EQUALS_BA_PROPER_SUBSET_OF_BA_PROPER_SUPERSET_BA_PROPER_OVERLAPS_B(Code) | | Used for results of getContainmentRelation
|
asMap | public static Map asMap(Object[][] source, Map target, boolean reverse)(Code) | | Utility like Arrays.asList()
|
flatten | public static UnicodeSet flatten(UnicodeSet exemplar1)(Code) | | Modifies Unicode set to flatten the strings. Eg [abc{da}] => [abcd]
Returns the set for chaining.
Parameters: exemplar1 - |
getContainmentRelation | public static int getContainmentRelation(Collection a, Collection b)(Code) | | Assesses all the possible containment relations between collections A and B with one call.
Returns an int with bits set, according to a "Venn Diagram" view of A vs B.
NOT_A_SUPERSET_B: a - b != {}
NOT_A_DISJOINT_B: a * b != {} // * is intersects
NOT_A_SUBSET_B: b - a != {}
Thus the bits can be used to get the following relations:
for A_SUPERSET_B, use (x & CollectionUtilities.NOT_A_SUPERSET_B) == 0
for A_SUBSET_B, use (x & CollectionUtilities.NOT_A_SUBSET_B) == 0
for A_EQUALS_B, use (x & CollectionUtilities.NOT_A_EQUALS_B) == 0
for A_DISJOINT_B, use (x & CollectionUtilities.NOT_A_DISJOINT_B) == 0
for A_OVERLAPS_B, use (x & CollectionUtilities.NOT_A_DISJOINT_B) != 0
|
matchesAt | public static int matchesAt(CharSequence text, int offset, CharSequence other)(Code) | | Does one string contain another, starting at a specific offset?
Parameters: text - Parameters: offset - Parameters: other - |
span | public int span(CharSequence string, int offset, UnicodeSet testSet)(Code) | | Returns the ending offset found by matching characters with testSet, until a position is found that doen't match
Parameters: string - Parameters: offset - Parameters: testSet - |
spanNot | public int spanNot(CharSequence string, int offset, UnicodeSet testSet)(Code) | | Returns the ending offset found by matching characters with testSet, until a position is found that does match
Parameters: string - Parameters: offset - Parameters: testSet - |
|
|