Example usage for java.util TreeMap TreeMap

List of usage examples for java.util TreeMap TreeMap

Introduction

In this page you can find the example usage for java.util TreeMap TreeMap.

Prototype

public TreeMap() 

Source Link

Document

Constructs a new, empty tree map, using the natural ordering of its keys.

Usage

From source file:com.gammalabs.wifianalyzer.wifi.band.Country.java

Country() {
    countries = new TreeMap<>();
    for (Locale locale : Locale.getAvailableLocales()) {
        String countryCode = locale.getCountry();
        if (StringUtils.isNotEmpty(countryCode) && StringUtils.isAlpha(countryCode)
                && countryCode.length() == 2) {
            countries.put(StringUtils.capitalize(countryCode), locale);
        }// w w  w  . j  a  va2s.co  m
    }
}

From source file:com.jyzn.wifi.validate.other.SpringsidetoolsTest.java

@Test
public void getParametersStartingWithTest() {

    String paramName = "EQ_wifiuser.id";
    String prefix = "";
    String unprefixed = paramName.substring(prefix.length());
    String[] values = { "18691525183" };
    Map<String, Object> params = new TreeMap<>();
    if ((values == null) || (values.length == 0)) {
    } else if (values.length > 1) {
        params.put(unprefixed, values);//from  w w  w.j ava2s.  c  om
    } else {
        params.put(unprefixed, values[0]);
    }

    params.put("EQ_sid", "001");
    Map<String, SearchFilter> filters = SearchFilter.parse(params);

    assertNotNull(filters);

}

From source file:ee.signwise.sdk.model.MessageInfo.java

/**
 * Constructor for MessageInfo//from   www. j  a  v  a2  s.c  om
 * @param lang field name/placeholder
 * @param message field value
 */
public MessageInfo(String lang, String message) {
    m_messages = new TreeMap<String, String>();
    m_messages.put(lang, message);
}

From source file:com.ethlo.kfka.MapStoreTest.java

@Test
public void testStoreAll() {
    final Map<Long, CustomKfkaMessage> input = new TreeMap<>();
    input.put(123L, new CustomKfkaMessage.CustomKfkaMessageBuilder().topic("foobar").type("mytype")
            .payload("hello").id(123L).build());
    input.put(129L, new CustomKfkaMessage.CustomKfkaMessageBuilder().topic("foobar").type("mytype")
            .payload("goodbye").id(129L).build());
    mapStore.storeAll(input);/*from  w ww.  ja  v  a2  s .com*/

    final Map<Long, CustomKfkaMessage> output = mapStore.loadAll(input.keySet());
    assertThat(output).isEqualTo(input);
}

From source file:gov.nih.nci.cabio.portal.portlet.Results.java

public Results(Collection results, int page) {

    this.resultList = (List) results;
    this.page = page;
    this.items = new TreeMap<String, List<ResultItem>>();

    for (int i = page * PAGE_SIZE; i < page * PAGE_SIZE + PAGE_SIZE && i < resultList.size(); i++) {
        Object o = resultList.get(i);
        String className = ClassUtils.removeEnchancer(o.getClass().getName());
        List<ResultItem> objs = items.get(className);
        if (objs == null)
            objs = new ArrayList<ResultItem>();
        items.put(className, objs);//from ww  w  .  j  a v a  2s .c o m
        objs.add(new ResultItem(o));
    }

    log.info("done grouping " + results.size() + " items into " + items.size() + " classes");
}

From source file:it.zero11.acme.utils.JWKUtils.java

public static TreeMap<String, Object> getWebKey(PublicKey publicKey) {
    TreeMap<String, Object> key = new TreeMap<>();
    if (publicKey instanceof RSAPublicKey) {
        key.put("kty", "RSA");
        key.put("e",
                TextCodec.BASE64URL.encode(toIntegerBytes(((RSAPublicKey) publicKey).getPublicExponent())));
        key.put("n", TextCodec.BASE64URL.encode(toIntegerBytes(((RSAPublicKey) publicKey).getModulus())));
        return key;
    } else {//from  w  w w.j  a va 2  s  . c  o m
        throw new IllegalArgumentException();
    }
}

From source file:it.osm.gtfs.input.OSMParser.java

public static Map<String, Stop> applyGTFSIndex(List<Stop> stops)
        throws ParserConfigurationException, SAXException, IOException {
    final Map<String, Stop> result = new TreeMap<String, Stop>();

    for (Stop s : stops) {
        if (s.getGtfsId() != null && s.getGtfsId() != "") {
            result.put(s.getGtfsId(), s);
        }/*from   w ww. ja  v  a2s. c o m*/
    }

    return result;
}

From source file:com.l2jfree.util.HandlerRegistry.java

public HandlerRegistry(boolean sorted) {
    this(sorted ? new TreeMap<K, V>() : new HashMap<K, V>());
}

From source file:de.jcup.egradle.codeassist.dsl.ApiMappingImporter.java

/**
 * Imports mapping//from   w  w w .j  a v a2 s .co  m
 * 
 * @param stream
 * @return map never <code>null</code>. Map keys are shortnames, values are
 *         long names
 * @throws IOException
 */
public Map<String, String> importMapping(InputStream stream) throws IOException {
    Map<String, String> map = new TreeMap<>();
    try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream))) {
        String line = "";
        while ((line = reader.readLine()) != null) {
            /* file contains as following "shortName:longName;" */
            String[] parts = StringUtils.split(line, ":;");
            if (parts == null) {
                continue;
            }
            if (parts.length < 2) {
                continue;
            }
            map.put(parts[0], parts[1]);
        }
        return map;
    }
}

From source file:com.github.khazrak.jdocker.utils.Filters.java

public Filters() {
    mapper = new ObjectMapper();
    filtersMap = new TreeMap<>();
}