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:TokenizerUtil.java

public static Map<String, String> convertCSVStringToMap(String s) {
    TreeMap<String, String> map = new TreeMap<String, String>();
    StringTokenizer st = new StringTokenizer(s, "|");
    while (st.hasMoreTokens()) {
        String keyToken = st.nextToken();
        String valueToken = st.nextToken();
        map.put(keyToken, valueToken);/* w w  w.  j a  v a2s .  c  om*/
    }
    return map;
}

From source file:guru.nidi.languager.PropertiesFinder.java

public SortedMap<String, Message> findProperties() throws IOException {
    SortedMap<String, Message> messages = new TreeMap<>();
    PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
    for (String propertyLocation : propertyLocations) {
        Resource[] resources = resolver.getResources(propertyLocation + "*" + PROPERTIES);
        for (Resource resource : resources) {
            String lang = resource.getFilename();
            lang = lang.substring(Math.max(0, lang.length() - 20), lang.length() - PROPERTIES.length());
            int pos = lang.indexOf('_');
            if (pos < 0) {
                lang = "";
            } else {
                lang = lang.substring(pos + 1);
            }/*from  ww  w. j a v  a2  s  .co m*/
            Properties props = new Properties();
            props.load(resource.getInputStream());
            for (String name : props.stringPropertyNames()) {
                Message message = messages.get(name);
                if (message == null) {
                    message = new Message(name, FOUND, null);
                    messages.put(name, message);
                }
                message.addValue(lang, props.getProperty(name));
            }
        }
    }
    return messages;
}

From source file:com.opengamma.analytics.financial.forex.method.MultipleCurrencyInterestRateCurveSensitivity.java

/**
 * Constructor. A new map is created.
 */
public MultipleCurrencyInterestRateCurveSensitivity() {
    _sensitivity = new TreeMap<>();
}

From source file:ddf.catalog.transformer.html.models.HtmlCategoryModel.java

public HtmlCategoryModel() {
    this("", new ArrayList<>());
    this.attributeMappings = new TreeMap<>();
}

From source file:de.tudarmstadt.ukp.experiments.argumentation.sequence.significance.OutcomeSuccessMapReaderSequenceTokenCSVImpl.java

@Override
public SortedMap<String, Boolean> readOutcomeSuccessMap(File file) {
    SortedMap<String, Boolean> result = new TreeMap<>();

    List<String> lines;
    try {/*from w  w w.ja va2  s. c  om*/
        lines = FileUtils.readLines(file);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }

    // first line is comment
    for (int i = 1; i < lines.size(); i++) {
        String line = lines.get(i);

        String[] split = line.split(",");

        String token = split[2];

        String key = i + "_" + token;
        boolean res = split[0].equals(split[1]);

        result.put(key, res);
    }

    return result;
}

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

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

From source file:com.offbynull.voip.kademlia.model.TimeSet.java

public TimeSet() {
    valueLookup = new HashMap<>();
    timeLookup = new TreeMap<>();
    timeLookupDecorator = MultiValueMap.multiValueMap(timeLookup, () -> new HashSet<>());
}

From source file:com.opengamma.analytics.financial.interestrate.market.description.MultipleCurrencyCurveSensitivityMarket.java

/** 
 * Constructor. A new map is created.
 */
public MultipleCurrencyCurveSensitivityMarket() {
    _sensitivity = new TreeMap<Currency, CurveSensitivityMarket>();
}

From source file:com.qrmedia.commons.collections.MapUtilsTest.java

@Test
public void toMap_null() {
    assertEquals(new TreeMap<Object, Object>(), MapUtils.toMap((Object[]) null));
}

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

Country() {
    countries = new TreeMap<>();
    IterableUtils.forEach(/* w  ww. j a  va2  s.c o m*/
            CollectionUtils.select(Arrays.asList(Locale.getAvailableLocales()), new CountryPredicate()),
            new CountryClosure());
}