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

private SortedMap getSortedButtons(Container focusCycleRoot) {
    if (focusCycleRoot == null) {
        throw new IllegalArgumentException("focusCycleRoot can't be null");
    }//from  ww  w .  j  a v  a  2s.  co  m
    SortedMap result = new TreeMap(); // Will sort all buttons by text.
    sortRecursive(result, focusCycleRoot);
    return result;
}

From source file:no.digipost.api.useragreements.client.filters.request.RequestToSign.java

public SortedMap<String, String> getHeaders() {
    TreeMap<String, String> sortedHeaders = new TreeMap<String, String>();
    Header[] headers = clientRequest.getAllHeaders();
    for (Header header : headers) {
        sortedHeaders.put(header.getName(), header.getValue());
    }//from ww w .  j av a2  s  . c  o  m
    return sortedHeaders;
}

From source file:com.feilong.tools.net.httpclient3.NameValuePairUtil.java

/**
 * nameValuePairs?Map./* w w w .ja va 2  s .c  o m*/
 *
 * @param nameValuePairs
 *            the name value pairs
 * @return if (Validator.isNotNullOrEmpty(nameValuePairs)), will return Collections.emptyMap()
 * @since 1.0.9
 */
public static Map<String, String> toMap(NameValuePair[] nameValuePairs) {
    if (Validator.isNotNullOrEmpty(nameValuePairs)) {
        Map<String, String> map = new TreeMap<String, String>();

        for (NameValuePair nameValuePair : nameValuePairs) {
            map.put(nameValuePair.getName(), nameValuePair.getValue());
        }

        return map;
    }
    return Collections.emptyMap();
}

From source file:de.tudarmstadt.ukp.experiments.argumentation.sequence.evaluation.helpers.FinalTableExtractor.java

public static void createCrossEvaluationTables(File mainFolder, final String prefix) throws IOException {
    Map<String, Table<String, String, Double>> domainResults = new TreeMap<>();

    File[] crossDomainFolders = mainFolder.listFiles(new FileFilter() {
        @Override/*from   w  w w.ja  v a 2  s. c o  m*/
        public boolean accept(File pathname) {
            return pathname.isDirectory() && pathname.getName().startsWith(prefix);
        }
    });

    System.out.println(Arrays.toString(crossDomainFolders));

    for (File crossDomainFolder : crossDomainFolders) {
        // get the target domain
        String[] folderNameSplit = crossDomainFolder.getName().split("_");
        String domain = folderNameSplit[1];
        String featureSet = folderNameSplit[2];

        File resultSummaryFile = new File(crossDomainFolder, "resultSummary.txt");
        for (String line : FileUtils.readLines(resultSummaryFile)) {
            // parse the line with evaluation
            String[] split = line.split("\\s+");
            String argumentComponent = split[0];
            Double value = Double.valueOf(split[1]);

            // create a new table if needed
            if (!domainResults.containsKey(domain)) {
                domainResults.put(domain, TreeBasedTable.<String, String, Double>create());
            }

            // fill the table
            Table<String, String, Double> table = domainResults.get(domain);

            if (includeColumn(argumentComponent)) {
                table.put(featureSet, argumentComponent, value);
            }
        }
    }

    System.out.println(domainResults.keySet());

    for (Map.Entry<String, Table<String, String, Double>> entry : domainResults.entrySet()) {

        System.out.println(entry.getKey());
        System.out.println(tableToCsv(entry.getValue()));
    }
}

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

/**
 * Create a new multiple currency sensitivity with one currency.
 * @param ccy The currency. Not null.//from  w  w  w .j a  v  a2 s  . c  o m
 * @param sensitivity The sensitivity associated to the currency. The sensitivity is used directly (not copied). Not null.
 * @return The multiple currency sensitivity.
 */
public static MultipleCurrencyInterestRateCurveSensitivity of(final Currency ccy,
        final InterestRateCurveSensitivity sensitivity) {
    ArgumentChecker.notNull(ccy, "Currency");
    ArgumentChecker.notNull(sensitivity, "Sensitivity");
    final TreeMap<Currency, InterestRateCurveSensitivity> map = new TreeMap<>();
    map.put(ccy, sensitivity);
    return new MultipleCurrencyInterestRateCurveSensitivity(map);
}

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

/**
 * Create a new multiple currency sensitivity with one currency.
 * @param ccy The currency. Not null.//from w  w  w. j av a 2s.  c  om
 * @param sensitivity The sensitivity associated to the currency. Not null.
 * @return The multiple currency sensitivity.
 */
public static MultipleCurrencyCurveSensitivityMarket of(final Currency ccy,
        final CurveSensitivityMarket sensitivity) {
    ArgumentChecker.notNull(ccy, "Currency");
    ArgumentChecker.notNull(sensitivity, "Sensitivity");
    final TreeMap<Currency, CurveSensitivityMarket> map = new TreeMap<Currency, CurveSensitivityMarket>();
    map.put(ccy, sensitivity);
    return new MultipleCurrencyCurveSensitivityMarket(map);
}

From source file:com.iveely.computing.component.TupleBuffer.java

/**
 * Build tuple buffer instance.
 */
public TupleBuffer() {
    this.list = new TreeMap<>();
}

From source file:com.opengamma.analytics.financial.provider.sensitivity.multicurve.MultipleCurrencyMulticurveSensitivity.java

/**
 * Create a new multiple currency sensitivity with one currency.
 * @param ccy The currency. Not null./*from   w  w  w  . j  av a2  s .c  o  m*/
 * @param sensitivity The sensitivity associated to the currency. Not null.
 * @return The multiple currency sensitivity.
 */
public static MultipleCurrencyMulticurveSensitivity of(final Currency ccy,
        final MulticurveSensitivity sensitivity) {
    ArgumentChecker.notNull(ccy, "Currency");
    ArgumentChecker.notNull(sensitivity, "Sensitivity");
    final TreeMap<Currency, MulticurveSensitivity> map = new TreeMap<>();
    map.put(ccy, sensitivity);
    return new MultipleCurrencyMulticurveSensitivity(map);
}

From source file:com.rylinaux.plugman.util.BukGetUtil.java

/**
 * Check which plugins are up-to-date or not.
 *
 * @return a map of the plugins and the results.
 *///from  ww w.  j  ava2s.c o  m
public static Map<String, UpdateResult> checkUpToDate() {
    Map<String, UpdateResult> results = new TreeMap<>();
    for (Plugin plugin : Bukkit.getPluginManager().getPlugins())
        results.put(plugin.getName(), checkUpToDate(plugin.getName()));
    return results;
}

From source file:com.opengamma.analytics.financial.provider.sensitivity.inflation.MultipleCurrencyInflationSensitivity.java

/**
 * Create a new multiple currency sensitivity with one currency.
 * @param ccy The currency. Not null./*from  w ww  . j a v a2s  .c  om*/
 * @param sensitivity The sensitivity associated to the currency. Not null.
 * @return The multiple currency sensitivity.
 */
public static MultipleCurrencyInflationSensitivity of(final Currency ccy,
        final InflationSensitivity sensitivity) {
    ArgumentChecker.notNull(ccy, "Currency");
    ArgumentChecker.notNull(sensitivity, "Sensitivity");
    final TreeMap<Currency, InflationSensitivity> map = new TreeMap<>();
    map.put(ccy, sensitivity);
    return new MultipleCurrencyInflationSensitivity(map);
}