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:org.b1.pack.cli.FileTools.java

public static Map<List<String>, FsObject> createRootMap(List<String> names) {
    Map<List<String>, FsObject> map = Maps.newLinkedHashMap();
    for (String name : names.isEmpty() ? Collections.singleton(".") : names) {
        File file = new File(name);
        List<String> path = getPath(file);
        Preconditions.checkState(map.put(path, new FsObject(file, path)) == null, "Duplicate path: %s", path);
    }//from   w  w  w  .  java2s .  c  om
    return map;
}

From source file:org.nanoframework.core.component.aop.BeforeAndAfterMoreInterceptor.java

@Override
public Object invoke(final MethodInvocation invocation) throws Throwable {
    final BeforeAndAfterMore beforeAndAfterMore = invocation.getMethod()
            .getAnnotation(BeforeAndAfterMore.class);
    final Map<Method, Object> beforeMap = Maps.newLinkedHashMap();
    final Map<Method, Object> afterMap = Maps.newLinkedHashMap();
    for (BeforeAndAfter beforeAndAfter : beforeAndAfterMore.value()) {
        final Object instance = Globals.get(Injector.class).getInstance(beforeAndAfter.value());
        final Method beforeMethod = beforeAndAfter.value().getMethod(MethodNames.BEFORE,
                MethodInvocation.class);
        final Method afterMethod = beforeAndAfter.value().getMethod(MethodNames.AFTER, MethodInvocation.class,
                Object.class);
        beforeMap.put(beforeMethod, instance);
        afterMap.put(afterMethod, instance);
    }/*from w ww .  ja  va 2  s  . c  om*/

    Object obj = null;
    try {
        for (final Iterator<Entry<Method, Object>> iter = beforeMap.entrySet().iterator(); iter.hasNext();) {
            final Entry<Method, Object> entry = iter.next();
            entry.getKey().invoke(entry.getValue(), invocation);
        }

        return obj = invocation.proceed();
    } catch (final Throwable e) {
        obj = e;
        throw e;

    } finally {
        for (final Iterator<Entry<Method, Object>> iter = afterMap.entrySet().iterator(); iter.hasNext();) {
            final Entry<Method, Object> entry = iter.next();
            entry.getKey().invoke(entry.getValue(), invocation, obj);
        }
    }
}

From source file:brooklyn.location.waratek.AggregatingWaratekLocation.java

public AggregatingWaratekLocation() {
    super(Maps.newLinkedHashMap());
}

From source file:org.carrot2.util.attribute.AttributeValueSets.java

/**
 * Creates an empty collection of attribute value sets.
 */
public AttributeValueSets() {
    this.attributeValueSets = Maps.newLinkedHashMap();
}

From source file:org.terasology.persistence.typeHandling.mathTypes.Rect2fTypeHandler.java

@Override
public PersistedData serialize(Rect2f value, SerializationContext context) {
    Map<String, PersistedData> map = Maps.newLinkedHashMap();
    map.put(MIN_FIELD, context.create(value.min(), Vector2f.class));
    map.put(SIZE_FIELD, context.create(value.size(), Vector2f.class));
    return context.create(map);
}

From source file:org.terasology.persistence.typeHandling.mathTypes.Rect2iTypeHandler.java

@Override
public PersistedData serialize(Rect2i value, SerializationContext context) {
    Map<String, PersistedData> map = Maps.newLinkedHashMap();
    map.put(MIN_FIELD, context.create(value.min(), Vector2i.class));
    map.put(SIZE_FIELD, context.create(value.size(), Vector2i.class));
    return context.create(map);
}

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

ConstructorWriter(String name) {
    this.name = name;
    this.parameterWriters = Maps.newLinkedHashMap();
    this.blockWriter = new BlockWriter();
}

From source file:exec.csharp.evaluation.impl.F1ByCategory.java

@Override
public void run() {
    res = Maps.newLinkedHashMap();
    for (QueryMode qm : QueryMode.values()) {
        Map<QueryContent, BoxplotData> qms = Maps.newLinkedHashMap();
        res.put(qm, qms);/*from  w ww.  ja  va 2s  . co m*/

        for (QueryContent qc : QueryContent.values()) {
            qms.put(qc, new BoxplotData());
        }
    }

    counts = Maps.newLinkedHashMap();
    for (QueryContent qc : QueryContent.values()) {
        counts.put(qc, 0);
    }

    eval.run(this);
}

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

public static void init(CompilerInformation info, IServiceProvider sp) {
    generators = Maps.newLinkedHashMap();
    for (final IHDLGenerator gen : sp.getAllGenerators()) {
        for (final String name : gen.getNames()) {
            generators.put(name, gen);/*from w  w  w. j ava 2  s.  c o m*/
            info.registeredGenerators.put(name, gen.getGeneratorInfo(name));
        }
    }
}

From source file:com.enonic.cms.core.content.mail.AbstractAssignmentMailTemplate.java

protected String createAssignmentMailInfoElement() {
    String contentPath = content.getPathAsString();

    StringBuffer body = new StringBuffer();

    Map<String, String> keyValues = Maps.newLinkedHashMap();

    if (StringUtils.isNotBlank(contentPath)) {
        addKeyValue(keyValues, "%fldStatus%", getTranslatedStatus(contentVersion.getStatus()));

        if (assignmentDueDate != null) {
            addKeyValue(keyValues, "%contentAssignmentDuedate%",
                    DATE_FORMAT.print(assignmentDueDate.getTime()));
        }//  w  w  w  . j  a  v a 2 s .  co m

        addKeyValue(keyValues, "%fldDisplayName%", contentVersion.getTitle());
        addKeyValue(keyValues, "%fldContentType%", content.getContentType().getName());
        addKeyValue(keyValues, "%contentAssignedBy%", createUserName(assigner));
        addKeyValue(keyValues, "%contentAssignmentPath%", contentPath);
    }

    String adminUrl = getAdminUrl(content.getKey());

    if (StringUtils.isNotBlank(adminUrl)) {
        addKeyValue(keyValues, "%blockURL%", adminUrl);
    }

    appendKeyValuesWithPadding(body, keyValues);

    return body.toString();
}