Java Code Examples for java.util.Locale.getUnicodeLocaleKeys()

The following are Jave code examples for showing how to use getUnicodeLocaleKeys() of the java.util.Locale class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: jdk8u-jdk   File: LocaleEnhanceTest.java   Source Code and License Vote up 5 votes
public void testGetUnicodeLocaleKeys() {
    Locale locale = Locale.forLanguageTag("und-u-co-japanese-nu-thai");
    Set<String> result = locale.getUnicodeLocaleKeys();
    assertEquals("two keys", 2, result.size());
    assertTrue("co and nu", result.contains("co") && result.contains("nu"));

    // result is not modifiable
    try {
        result.add("frobozz");
        errln("expected exception when add to locale key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }
}
 
Example 2
Project: openjdk-jdk10   File: LocaleEnhanceTest.java   Source Code and License Vote up 5 votes
public void testGetUnicodeLocaleKeys() {
    Locale locale = Locale.forLanguageTag("und-u-co-japanese-nu-thai");
    Set<String> result = locale.getUnicodeLocaleKeys();
    assertEquals("two keys", 2, result.size());
    assertTrue("co and nu", result.contains("co") && result.contains("nu"));

    // result is not modifiable
    try {
        result.add("frobozz");
        errln("expected exception when add to locale key set");
    }
    catch (UnsupportedOperationException e) {
        // ok
    }
}