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(SortedMap<K, ? extends V> m) 

Source Link

Document

Constructs a new tree map containing the same mappings and using the same ordering as the specified sorted map.

Usage

From source file:edu.umd.cfar.lamp.viper.util.Range.java

/**
 * Creates a new, empty Range.
 * @param c The comparison to use while adding items to the range.
 */
public Range(Comparator c) {
    spans = new TreeMap(c);
}

From source file:com.scraper.SignedRequestsHelper.java

public String sign(Map<String, String> params) {
    params.put("AWSAccessKeyId", awsAccessKeyId);
    params.put("Timestamp", timestamp());
    params.put("AssociateTag", AssociateTag);

    SortedMap<String, String> sortedParamMap = new TreeMap<String, String>(params);
    String canonicalQS = canonicalize(sortedParamMap);
    String toSign = REQUEST_METHOD + "\n" + endpoint + "\n" + REQUEST_URI + "\n" + canonicalQS;

    String hmac = hmac(toSign);/*from w w  w.j a v  a 2  s. co  m*/
    String sig = percentEncodeRfc3986(hmac);
    String url = "http://" + endpoint + REQUEST_URI + "?" + canonicalQS + "&Signature=" + sig;

    return url;
}