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:io.cloudslang.web.services.FlowsServiceImpl.java

@Override
@Cacheable/*  w  ww.  j  a va2s .co  m*/
public TreeMap<String, FlowVo> getFlows(String classpath) {
    Collection<File> cpFiles = getCpFiles(classpath);

    Map<String, FlowVo> flows = cpFiles.stream().map(this::fileToFlowVo)
            .collect(toMap(FlowVo::getId, Function.identity()));

    return new TreeMap<>(flows);

}

From source file:jease.cms.service.Informations.java

public Map<Class<?>, Integer> getDatabaseClassCount() {
    Map<Class<?>, Integer> resultMap = new TreeMap<>(Comparator.comparing(Class::getName));
    //      for (Persistent obj : Database.query(Persistent.class)) {
    //         Class<?> clazz = obj.getClass();
    //         if (!resultMap.containsKey(clazz)) {
    //            resultMap.put(clazz, 0);
    //         }//  ww w  .  ja  va 2s  .com
    //         resultMap.put(clazz, resultMap.get(clazz) + 1);
    //      }
    return resultMap;
}

From source file:com.quartercode.eventbridge.def.channel.DefaultChannel.java

/**
 * Creates a new default channel.//  w  w w. j ava  2s . c o  m
 * 
 * @param interceptorType The type of interceptor that can be used by the channel.
 */
public DefaultChannel(Class<T> interceptorType) {

    this.interceptorType = interceptorType;

    interceptors = new TreeMap<>(new Comparator<Integer>() {

        @Override
        public int compare(Integer o1, Integer o2) {

            // Reverse the comparison in order to make the map ordering being large to small
            return Integer.compare(o2, o1);
        }

    });
}

From source file:de.kp.ames.web.core.json.DoubleCollector.java

public DoubleCollector() {

    collector = new TreeMap<Double, ArrayList<JSONObject>>(new Comparator<Double>() {
        public int compare(Double double1, Double double2) {
            return double1.compareTo(double2);
        }/*  w ww. j av  a 2s .c  om*/
    });

}

From source file:com.espertech.esper.filter.FilterParamIndexDoubleRangeBase.java

protected FilterParamIndexDoubleRangeBase(FilterSpecLookupable lookupable, FilterOperator filterOperator) {
    super(filterOperator, lookupable);

    ranges = new TreeMap<DoubleRange, EventEvaluator>(new DoubleRangeComparator());
    rangesNullEndpoints = new IdentityHashMap<DoubleRange, EventEvaluator>();
    rangesRWLock = new ReentrantReadWriteLock();
}

From source file:de.kp.ames.web.core.json.DateCollector.java

public DateCollector() {

    collector = new TreeMap<Date, ArrayList<JSONObject>>(new Comparator<Date>() {
        public int compare(Date date1, Date date2) {
            // this is a descending sorting of two dates
            return (-1) * date1.compareTo(date2);
        }//  w  w  w  .  j a  v a2  s. c  o m
    });

}

From source file:de.kp.ames.web.core.json.StringCollector.java

public StringCollector() {

    collector = new TreeMap<String, ArrayList<JSONObject>>(new Comparator<String>() {
        public int compare(String name1, String name2) {
            return name1.compareTo(name2);
        }//from  w ww . jav a  2s .c  o  m
    });

}

From source file:fitnesse.wiki.WikiPageProperty.java

public WikiPageProperty(WikiPageProperty that) {
    if (that != null && that.children != null)
        children = new TreeMap<>(that.children);
}

From source file:net.krotscheck.stk.stream.Schema.java

/**
 * Please use the builder instead.//from  w w  w  . j a v a2  s  . com
 *
 * @param schema The schema map to wrap.
 */
private Schema(final Map<String, Type> schema) {
    this.internalSchema = Collections.unmodifiableSortedMap(new TreeMap<>(schema));
}

From source file:backtype.storm.localizer.LocalizedResourceRetentionSet.java

LocalizedResourceRetentionSet(long targetSize, Comparator<? super LocalizedResource> cmp) {
    this(targetSize, new TreeMap<LocalizedResource, LocalizedResourceSet>(cmp));
}