Search in sources :

Example 6 with UnicodeMap

use of android.icu.dev.util.UnicodeMap in project j2objc by google.

the class UnicodeMapTest method TestAUnicodeMapInverse.

public void TestAUnicodeMapInverse() {
    UnicodeMap<Character> foo1 = new UnicodeMap<Character>().putAll('a', 'z', 'b').put("ab", 'c').put('x', 'b').put("xy", 'c');
    Map<Character, UnicodeSet> target = new HashMap<Character, UnicodeSet>();
    foo1.addInverseTo(target);
    UnicodeMap<Character> reverse = new UnicodeMap().putAllInverse(target);
    assertEquals("", foo1, reverse);
}
Also used : UCharacter(android.icu.lang.UCharacter) HashMap(java.util.HashMap) UnicodeMap(android.icu.dev.util.UnicodeMap) UnicodeSet(android.icu.text.UnicodeSet)

Example 7 with UnicodeMap

use of android.icu.dev.util.UnicodeMap in project j2objc by google.

the class UnicodeMapTest method TestRemove.

@Test
public void TestRemove() {
    UnicodeMap<Double> foo = new UnicodeMap().putAll(0x20, 0x29, -2d).put("abc", 3d).put("xy", 2d).put("mark", 4d).freeze();
    UnicodeMap<Double> fii = new UnicodeMap().putAll(0x21, 0x25, -2d).putAll(0x26, 0x28, -3d).put("abc", 3d).put("mark", 999d).freeze();
    UnicodeMap<Double> afterFiiRemoval = new UnicodeMap().put(0x20, -2d).putAll(0x26, 0x29, -2d).put("xy", 2d).put("mark", 4d).freeze();
    UnicodeMap<Double> afterFiiRetained = new UnicodeMap().putAll(0x21, 0x25, -2d).put("abc", 3d).freeze();
    UnicodeMap<Double> test = new UnicodeMap<Double>().putAll(foo).removeAll(fii);
    assertEquals("removeAll", afterFiiRemoval, test);
    test = new UnicodeMap<Double>().putAll(foo).retainAll(fii);
    assertEquals("retainAll", afterFiiRetained, test);
}
Also used : UnicodeMap(android.icu.dev.util.UnicodeMap) Test(org.junit.Test)

Example 8 with UnicodeMap

use of android.icu.dev.util.UnicodeMap in project j2objc by google.

the class UnicodeMapTest method TestAUnicodeMap2.

public void TestAUnicodeMap2() {
    UnicodeMap foo = new UnicodeMap();
    @SuppressWarnings("unused") int // make sure doesn't NPE
    hash = foo.hashCode();
    @SuppressWarnings("unused") Set // make sure doesn't NPE
    fii = foo.stringKeys();
}
Also used : UnicodeSet(android.icu.text.UnicodeSet) SortedSet(java.util.SortedSet) Set(java.util.Set) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) UnicodeMap(android.icu.dev.util.UnicodeMap)

Aggregations

UnicodeMap (android.icu.dev.util.UnicodeMap)8 UnicodeSet (android.icu.text.UnicodeSet)4 HashMap (java.util.HashMap)4 Test (org.junit.Test)3 TreeSet (java.util.TreeSet)2 UnicodeMapIterator (android.icu.dev.util.UnicodeMapIterator)1 UCharacter (android.icu.lang.UCharacter)1 CanonicalIterator (android.icu.text.CanonicalIterator)1 Normalizer2 (android.icu.text.Normalizer2)1 ReplaceableString (android.icu.text.ReplaceableString)1 Transliterator (android.icu.text.Transliterator)1 CaseInsensitiveString (android.icu.util.CaseInsensitiveString)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 Random (java.util.Random)1 Set (java.util.Set)1 SortedMap (java.util.SortedMap)1 SortedSet (java.util.SortedSet)1 TreeMap (java.util.TreeMap)1