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.gradle.api.internal.tasks.compile.processing.AnnotationProcessorDetector.java

public Map<String, AnnotationProcessorDeclaration> detectProcessors(Iterable<File> processorPath) {
    Map<String, AnnotationProcessorDeclaration> processors = Maps.newLinkedHashMap();
    for (File jarOrClassesDir : processorPath) {
        for (AnnotationProcessorDeclaration declaration : cache.get(jarOrClassesDir)) {
            String className = declaration.getClassName();
            if (!processors.containsKey(className)) {
                processors.put(className, declaration);
            }/*from w  ww . j av  a2s .  c  o m*/
        }
    }
    return processors;
}

From source file:org.sakaiproject.kernel.model.FriendsBean.java

/**
 * @param friends//from w ww. j  a  v  a  2 s .co m
 *          the friends to set
 */
public void setFriends(List<FriendBean> friends) {
    Map<String, FriendBean> newFriends = Maps.newLinkedHashMap();
    for (FriendBean fb : friends) {
        newFriends.put(fb.getFriendUuid(), fb);
    }
    this.friends = newFriends;
}

From source file:com.google.auto.value.processor.escapevelocity.Macro.java

Object evaluate(EvaluationContext context, List<Node> thunks) {
    try {//from   www.  j  a va  2 s  . c  om
        Verify.verify(thunks.size() == parameterNames.size(), "Argument mistmatch for %s", name);
        Map<String, Node> parameterThunks = Maps.newLinkedHashMap();
        for (int i = 0; i < parameterNames.size(); i++) {
            parameterThunks.put(parameterNames.get(i), thunks.get(i));
        }
        EvaluationContext newContext = new MacroEvaluationContext(parameterThunks, context);
        return body.evaluate(newContext);
    } catch (EvaluationException e) {
        EvaluationException newException = new EvaluationException(
                "In macro #" + name + " defined on line " + definitionLineNumber + ": " + e.getMessage());
        newException.setStackTrace(e.getStackTrace());
        throw e;
    }
}

From source file:jflowmap.FlowMapGraphSet.java

public Map<String, String> mapOfNodeIdsToAttrValues(String nodeAttr) {
    Map<String, String> nodeIdsToLabels = Maps.newLinkedHashMap();
    for (FlowMapGraph fmg : asList()) {
        nodeIdsToLabels.putAll(fmg.mapOfNodeIdsToAttrValues(nodeAttr));
    }/* w  ww  .j  a v  a  2  s. c  o  m*/
    return nodeIdsToLabels;
}

From source file:org.smartdeveloperhub.vocabulary.ci.ValueUtils.java

ValueUtils(final URI base, final Map<String, String> namespaceTable) {
    this.base = base;
    this.namespaceTable = Maps.newLinkedHashMap();
    for (final Entry<String, String> entry : namespaceTable.entrySet()) {
        this.namespaceTable.put(entry.getValue(), entry.getKey());
    }// w  w w .  ja va 2  s .  c o  m
}

From source file:brooklyn.rest.resources.EntityConfigResource.java

@Override
public Map<String, Object> batchConfigRead(String application, String entityToken, Boolean raw) {
    // TODO: add test
    EntityLocal entity = brooklyn().getEntity(application, entityToken);
    Map<ConfigKey<?>, Object> source = ((EntityInternal) entity).getAllConfig();
    Map<String, Object> result = Maps.newLinkedHashMap();
    for (Map.Entry<ConfigKey<?>, Object> ek : source.entrySet()) {
        Object value = ek.getValue();
        if (Boolean.FALSE.equals(raw)) {
            value = RendererHints.applyDisplayValueHint(ek.getKey(), value);
        }//from w  w w  .  ja  v a2 s  .  c  o m
        result.put(ek.getKey().getName(), getValueForDisplay(value, true, false));
    }
    return result;
}

From source file:org.graylog2.inputs.transports.SyslogTcpTransport.java

@Override
protected LinkedHashMap<String, Callable<? extends ChannelHandler>> getFinalChannelHandlers(
        MessageInput input) {//  www.ja  v  a2s . c om
    final LinkedHashMap<String, Callable<? extends ChannelHandler>> finalChannelHandlers = Maps
            .newLinkedHashMap();

    finalChannelHandlers.putAll(super.getFinalChannelHandlers(input));

    // Replace the "framer" channel handler inserted by the parent.
    finalChannelHandlers.put("framer", new Callable<ChannelHandler>() {
        @Override
        public ChannelHandler call() throws Exception {
            return new SyslogTCPFramingRouterHandler(maxFrameLength, delimiter);
        }
    });

    return finalChannelHandlers;
}

From source file:com.medallia.tiny.ObjectProvider.java

/**
 * Creates a new ObjectProvider with no registered objects
 */
public ObjectProvider() {
    map = Maps.newLinkedHashMap();
    annotationMap = Maps.newLinkedHashMap();
}

From source file:com.kolich.curacao.mappers.request.matchers.AntPathMatcher.java

@Nullable
@Override//from ww  w.j ava  2  s. c om
public final Map<String, String> match(@Nonnull final CuracaoContext context, @Nonnull final String key,
        @Nonnull final String path) throws Exception {
    final Map<String, String> variables = Maps.newLinkedHashMap();
    return doMatch(key, path, true, variables) ?
    // Extracted path variables are returned to the caller bound
    // within an immutable map instance.
            ImmutableMap.copyOf(variables) : null;
}

From source file:org.glowroot.plugin.servlet.ResponseHeaderComponent.java

synchronized void setHeader(String name, Object value) {
    if (responseHeaders == null) {
        responseHeaders = Maps.newLinkedHashMap();
    }//  ww  w .  j av  a 2 s .c  om
    String nameUpper = name.toUpperCase(Locale.ENGLISH);
    ResponseHeader responseHeader = responseHeaders.get(nameUpper);
    if (responseHeader == null) {
        responseHeaders.put(nameUpper, new ResponseHeader(name, value));
    } else {
        responseHeader.setValue(value);
    }
}