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:parquet.tools.read.SimpleMapRecord.java

@Override
protected Object toJsonObject() {
    Map<String, Object> result = Maps.newLinkedHashMap();
    for (NameValue value : values) {
        String key = null;/*  w w  w  .  j ava2s. co m*/
        Object val = null;
        for (NameValue kv : ((SimpleRecord) value.getValue()).values) {
            if (kv.getName().equals("key")) {
                key = (String) kv.getValue();
            } else if (kv.getName().equals("value")) {
                val = toJsonValue(kv.getValue());
            }
        }
        result.put(key, val);
    }
    return result;
}

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

protected Map<String, Path<?>> getColumns(RelationalPath<?> path) {
    Map<String, Path<?>> columns = Maps.newLinkedHashMap();
    for (Path<?> column : path.getColumns()) {
        columns.put(column.getMetadata().getName(), column);
    }//from  w ww . java2s  .  c  o  m
    return columns;
}

From source file:org.pshdl.model.types.builtIn.HDLAnnotations.java

public static void init(CompilerInformation info, IServiceProvider sp) {
    annotations = Maps.newLinkedHashMap();
    for (final IHDLAnnotation anno : sp.getAllAnnotations()) {
        annotations.put(anno.name(), anno);
        final AnnotationInformation annoInfo = anno.getAnnotationInformation();
        if (annoInfo == null)
            throw new IllegalArgumentException(anno.name() + " does not provide annotation info!");
        info.registeredAnnotations.put(anno.name(), annoInfo);
    }/*from w ww  . j  a va2  s . com*/
}

From source file:org.apache.kylin.tool.KylinConfigCLI.java

static private Map<String, String> getPropertiesByPrefix(Properties props, String prefix) {
    Map<String, String> result = Maps.newLinkedHashMap();
    for (Map.Entry<Object, Object> entry : props.entrySet()) {
        String entryKey = (String) entry.getKey();
        if (entryKey.startsWith(prefix)) {
            result.put(entryKey.substring(prefix.length()), (String) entry.getValue());
        }/*from ww  w. ja  v  a2 s.  c om*/
    }
    return result;
}

From source file:org.napile.compiler.lang.cfg.PseudocodeTraverser.java

public static <D> Map<Instruction, Edges<D>> collectData(@NotNull Pseudocode pseudocode, boolean directOrder,
        boolean lookInside, @NotNull D initialDataValue, @NotNull D initialDataValueForEnterInstruction,
        @NotNull InstructionDataMergeStrategy<D> instructionDataMergeStrategy) {

    Map<Instruction, Edges<D>> edgesMap = Maps.newLinkedHashMap();
    initializeEdgesMap(pseudocode, lookInside, edgesMap, initialDataValue);
    edgesMap.put(getStartInstruction(pseudocode, directOrder),
            Edges.create(initialDataValueForEnterInstruction, initialDataValueForEnterInstruction));

    boolean[] changed = new boolean[1];
    changed[0] = true;//from  ww w. ja  v a 2s  . c  o  m
    while (changed[0]) {
        changed[0] = false;
        collectDataFromSubgraph(pseudocode, directOrder, lookInside, edgesMap, instructionDataMergeStrategy,
                Collections.<Instruction>emptyList(), changed, false);
    }
    return edgesMap;
}

From source file:lib.BreadcrumbList.java

public BreadcrumbList() {
    crumbs = Maps.newLinkedHashMap();
}

From source file:exec.csharp.utils.MapSorter.java

public static <K extends Comparable<K>, V> Map<K, V> sortCustom(Map<K, V> map, Comparator<K> comparator) {

    Set<K> sortedKeys = new TreeSet<K>(comparator);

    sortedKeys.addAll(map.keySet());/*from   ww  w .  j av a  2 s.  co  m*/

    Map<K, V> sortedMap = Maps.newLinkedHashMap();
    for (K key : sortedKeys) {
        sortedMap.put(key, map.get(key));
    }

    return sortedMap;
}

From source file:org.gradle.tooling.internal.provider.runner.BuildModelsActionRunner.java

protected Object createModelResult(GradleInternal gradle, String modelName, ToolingModelBuilder builder) {
    Map<String, Object> models = Maps.newLinkedHashMap();
    if (builder instanceof ProjectToolingModelBuilder) {
        ((ProjectToolingModelBuilder) builder).addModels(modelName, gradle.getDefaultProject(), models);
    } else {//w ww . j a  v  a2s .  c o  m
        Object result = builder.buildAll(modelName, gradle.getDefaultProject());
        models.put(gradle.getDefaultProject().getPath(), result);
    }
    return models;
}

From source file:com.metamx.common.parsers.ToLowerCaseParser.java

@Override
public Map parse(String input) {
    Map<String, Object> line = baseParser.parse(input);
    Map<String, Object> retVal = Maps.newLinkedHashMap();
    for (Map.Entry<String, Object> entry : line.entrySet()) {
        String k = entry.getKey().toLowerCase();

        if (retVal.containsKey(k)) {
            // Duplicate key, case-insensitively
            throw new ParseException("Unparseable row. Duplicate key found : [%s]", k);
        }/*  w ww . j  a v  a  2s  . c  o  m*/

        retVal.put(k, entry.getValue());
    }
    return retVal;
}

From source file:org.apache.isis.core.commons.configbuilder.PrimerForEnvironmentVariableISIS_OPT.java

private static Map<String, String> fromEnv(final String env, final String separator) {
    final LinkedHashMap<String, String> map = Maps.newLinkedHashMap();
    if (env != null) {
        final List<String> keyAndValues = Splitter.on(separator).splitToList(env);
        for (String keyAndValue : keyAndValues) {
            final List<String> parts = Splitter.on("=").splitToList(keyAndValue);
            if (parts.size() == 2) {
                map.put(parts.get(0), parts.get(1));
            }/*from   www .ja va2  s . c  om*/
        }
    }
    return map;
}