Example usage for com.google.common.collect Maps newTreeMap

List of usage examples for com.google.common.collect Maps newTreeMap

Introduction

In this page you can find the example usage for com.google.common.collect Maps newTreeMap.

Prototype

public static <K extends Comparable, V> TreeMap<K, V> newTreeMap() 

Source Link

Document

Creates a mutable, empty TreeMap instance using the natural ordering of its elements.

Usage

From source file:com.palantir.atlasdb.table.description.render.TableFactoryRenderer.java

public TableFactoryRenderer(String schemaName, String packageName, Namespace defaultNamespace,
        Map<String, TableDefinition> definitions) {
    this.schemaName = schemaName;
    this.packageName = packageName;
    this.definitions = Maps.newTreeMap();
    this.defaultNamespace = defaultNamespace.getName();
    for (Entry<String, TableDefinition> entry : definitions.entrySet()) {
        this.definitions.put(Renderers.getClassTableName(entry.getKey(), entry.getValue()), entry.getValue());
    }// w  ww  .  j  a  v a  2  s .  c o m
}

From source file:com.huawei.streaming.api.AnnotationUtils.java

/**
 * configannotationstreamingconfig//from w  ww . j  av a  2 s. c  om
 *
 * @param obj bean
 * @return ?
 * @throws ApplicationBuildException ??
 */
public static TreeMap<String, String> getAnnotationsToConfig(Object obj) throws ApplicationBuildException {
    TreeMap<String, String> config = Maps.newTreeMap();
    Field[] fs = obj.getClass().getDeclaredFields();
    for (Field f : fs) {
        f.setAccessible(true);
        ConfigAnnotation annotation = f.getAnnotation(ConfigAnnotation.class);
        if (null != annotation) {
            String key = annotation.value();
            if (key == null) {
                continue;
            }
            Object value = getOperatorConfigValue(obj, f);
            if (value == null) {
                continue;
            }
            config.put(key, String.valueOf(value));
        }
    }

    if (obj instanceof UserDefinedSerDeAPI) {
        UserDefinedSerDeAPI udfDeser = (UserDefinedSerDeAPI) obj;
        if (udfDeser.getConfig() != null) {
            config.putAll(udfDeser.getConfig());
        }
    }

    return config;
}

From source file:com.google.caliper.runner.EnvironmentGetter.java

private Map<String, String> getProperties() {
    TreeMap<String, String> propertyMap = Maps.newTreeMap();

    Map<String, String> sysProps = Maps.fromProperties(System.getProperties());

    // Sometimes java.runtime.version is more descriptive than java.version
    String version = sysProps.get("java.version");
    String alternateVersion = sysProps.get("java.runtime.version");
    if (alternateVersion != null && alternateVersion.length() > version.length()) {
        version = alternateVersion;/*from   w  w  w.  j  ava 2s  .co  m*/
    }
    propertyMap.put("host.availableProcessors", Integer.toString(Runtime.getRuntime().availableProcessors()));

    String osName = sysProps.get("os.name");
    propertyMap.put("os.name", osName);
    propertyMap.put("os.version", sysProps.get("os.version"));
    propertyMap.put("os.arch", sysProps.get("os.arch"));

    if (osName.equals("Linux")) {
        getLinuxEnvironment(propertyMap);
    }

    return propertyMap;
}

From source file:com.griddynamics.jagger.engine.e1.sessioncomparation.monitoring.MonitoringStats.java

public MonitoringStats(Map<Long, Double> points) {
    this.points = Maps.newTreeMap();

    for (Map.Entry<Long, Double> entry : points.entrySet()) {
        this.points.put(entry.getKey(), entry.getValue());
    }/*from  w  w  w  .  j a va 2 s.  c  o  m*/
}

From source file:com.cloudera.science.ml.core.summary.SummaryBuilder.java

public SummaryBuilder categorical(String name, List<String> levels) {
    int index = Specs.getFieldId(spec, name);
    Map<String, Entry> hist = Maps.newTreeMap();
    for (String level : levels) {
        hist.put(level, new Entry(1L));
    }/*from   w  w w . j  a  v  a 2 s . c  o  m*/
    SummaryStats stat = new SummaryStats(name, hist, false);
    stats.set(index, stat);
    return this;
}

From source file:org.n52.matlab.connector.value.MatlabStruct.java

public MatlabStruct(Map<MatlabString, MatlabValue> value) {
    if (checkNotNull(value) instanceof SortedMap) {
        this.fields = value;
    } else {/* w w  w . j a  va2  s . com*/
        TreeMap<MatlabString, MatlabValue> sorted = Maps.newTreeMap();
        sorted.putAll(value);
        this.fields = sorted;
    }
}

From source file:nl.knaw.huygens.timbuctoo.model.ckcc.CKCCCollective.java

@Override
public Map<String, String> createRelSearchRep(Map<String, String> mappedIndexInformation) {
    Map<String, String> filteredMap = Maps.newTreeMap();
    addValueToMap(mappedIndexInformation, filteredMap, URN);

    return filteredMap;
}

From source file:org.eclipse.viatra.query.runtime.registry.data.RegistrySourceImpl.java

/**
 * Creates a new source with the given identifier and an empty entry map.
 * //from  w  w  w.j  a  v a 2  s.  c om
 * @param identifier
 *            for the source
 * @param querySpecificationStore
 *            that contains this source
 */
public RegistrySourceImpl(String identifier, QuerySpecificationStore querySpecificationStore) {
    this.identifier = identifier;
    this.querySpecificationStore = querySpecificationStore;
    this.fqnToEntryMap = Maps.newTreeMap();
}

From source file:com.ibm.vicos.config.DefaultServerModule.java

@Override
public void configure(Binder binder) {
    binder.bind(AtomicLong.class).annotatedWith(Names.named("lastInvokedSeqNo")).toInstance(new AtomicLong(0));

    binder.bind(AtomicLong.class).annotatedWith(Names.named("lastAppliedSeqNo")).toInstance(new AtomicLong(0));

    binder.bind(State.class).toInstance(new KVSState(Maps.newTreeMap()));

    binder.bind(OperationProcessor.class).to(KVSCompatibleOperationProcessor.class);

    binder.bind(CryptoUtils.class).to(RSACryptoUtilsImpl.class);

    binder.bind(ServerProtocol.class).to(ServerProtocolImpl.class);
}

From source file:org.apache.isis.core.runtime.runner.opts.OptionHandlerInitParameters.java

private static Map<String, String> asMap(ServletContext servletContext) {
    Enumeration<String> initParameterNames = servletContext.getInitParameterNames();
    final Map<String, String> map = Maps.newTreeMap();
    while (initParameterNames.hasMoreElements()) {
        final String initParameterName = initParameterNames.nextElement();
        final String initParameterValue = servletContext.getInitParameter(initParameterName);
        if (initParameterName.startsWith("isis.")) {
            map.put(initParameterName, initParameterValue);
        }/*from www  .  j ava 2s.c o  m*/
    }
    return map;
}