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

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

Introduction

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

Prototype

public static <K, V> LinkedHashMap<K, V> newLinkedHashMap() 

Source Link

Document

Creates a mutable, empty, insertion-ordered LinkedHashMap instance.

Usage

From source file:com.googlecode.blaisemath.graph.app.MetricScaler.java

private void recompute() {
    scores = Maps.newLinkedHashMap();
    if (graph == null || metric == null) {
        return;//from www.  j a  v a  2s  .c o  m
    }
    for (Object n : graph.nodes()) {
        scores.put(n, (T) metric.apply(graph, n));
    }
    min = Ordering.natural().min(scores.values()).doubleValue();
    max = Ordering.natural().max(scores.values()).doubleValue();
}

From source file:com.querydsl.sql.dml.BeanMapper.java

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//  www  . j  a  v a2s .  c o  m
public Map<Path<?>, Object> createMap(RelationalPath<?> entity, Object bean) {
    Map<Path<?>, Object> values = Maps.newLinkedHashMap();
    Map<String, Object> map = new BeanMap(bean);
    Map<String, Path<?>> columns = getColumns(entity);
    // populate in column order
    for (Map.Entry<String, Path<?>> entry : columns.entrySet()) {
        Path<?> path = entry.getValue();
        if (map.containsKey(entry.getKey())) {
            Object value = map.get(entry.getKey());
            if (value != null) {
                values.put(path, value);
            } else if (withNullBindings && !isPrimaryKeyColumn(entity, path)) {
                values.put(path, Null.DEFAULT);
            }
        }
    }
    return values;
}

From source file:org.springside.examples.showcase.demos.utilities.xml.HouseMapAdapter.java

@Override
public Map<String, String> unmarshal(HouseMap houseMap) throws Exception {
    Map<String, String> map = Maps.newLinkedHashMap();
    for (HouseEntry e : houseMap.entries) {
        map.put(e.key, e.value);//from   w  ww.  j a v a 2  s  .  c  o m
    }
    return map;
}

From source file:cc.kave.episodes.statistics.EpisodesStatistics.java

private Map<Integer, Integer> initFreqs(Set<Episode> episodes) {
    Map<Integer, Integer> initializer = Maps.newLinkedHashMap();

    for (Episode ep : episodes) {
        int frequency = ep.getFrequency();
        if (!initializer.containsKey(frequency)) {
            initializer.put(frequency, 0);
        }/* w ww  .  j  a va 2 s  . c  o m*/
    }
    return initializer;
}

From source file:dagger2.internal.codegen.writer.TypeWriter.java

TypeWriter(ClassName name) {
    this.name = name;
    this.supertype = Optional.absent();
    this.implementedTypes = Lists.newArrayList();
    this.methodWriters = Lists.newArrayList();
    this.nestedTypeWriters = Lists.newArrayList();
    this.fieldWriters = Maps.newLinkedHashMap();
}

From source file:org.openehr.adl.parser.tree.AdlTreeDAdlParser.java

DAdlObject parseAdlObject(Tree tAdlObject) {
    if (tAdlObject.getType() == AdlParser.AST_NULL) {
        return new DAdlObject(tokenStream.get(tAdlObject.getParent().getTokenStartIndex()),
                Collections.<String, Tree>emptyMap());
    }//from   ww  w .j a  v a  2 s. c o  m

    assertTokenType(tAdlObject, AdlParser.AST_ADL_OBJECT);

    Map<String, Tree> properties = Maps.newLinkedHashMap();
    for (Tree tAdlObjectProperty : children(tAdlObject)) {
        assertTokenType(tAdlObjectProperty, AdlParser.AST_ADL_OBJECT_PROPERTY);

        String name = tAdlObjectProperty.getChild(0).getText();
        properties.put(name, tAdlObjectProperty.getChild(1));
    }
    return new DAdlObject(tokenStream.get(tAdlObject.getParent().getTokenStartIndex()), properties);
}

From source file:com.github.autermann.wps.matlab.description.MatlabProcessDescription.java

public MatlabProcessDescription() {
    this.inputs = Maps.newLinkedHashMap();
    this.outputs = Maps.newLinkedHashMap();
}

From source file:org.opendaylight.controller.cluster.raft.utils.InMemoryJournal.java

public static void addEntry(String persistenceId, long sequenceNr, Object data) {
    Map<Long, Object> journal = journals.get(persistenceId);
    if (journal == null) {
        journal = Maps.newLinkedHashMap();
        journals.put(persistenceId, journal);
    }/*w w  w.ja v  a2 s.co m*/

    synchronized (journal) {
        journal.put(sequenceNr,
                data instanceof Serializable ? SerializationUtils.serialize((Serializable) data) : data);
    }
}

From source file:com.homeadvisor.kafdrop.config.ini.IniFileProperties.java

public void addSectionProperty(String section, String name, String value) {
    Map<String, String> properties = doGetSectionProperties(section);
    if (section != null && properties == null) {
        properties = Maps.newLinkedHashMap();
        sectionProperties.put(section, properties);
    }//from www . ja  v a 2 s. c  o  m

    properties.put(name, value);
}

From source file:no.ssb.vtl.script.VTLScriptContext.java

public void addScope(int scope) {
    scopes.put(scope, new SimpleBindings(Maps.newLinkedHashMap()));
}