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.pshdl.model.validation.HDLValidator.java

/**
 * Initializes the {@link HDLValidator} with all validators using the
 * {@link IServiceProvider}. Also registers those validators withe the
 * {@link CompilerInformation}//from  w w w  .j ava2s  .  co m
 *
 * @param info
 * @param sp
 */
public static void init(CompilerInformation info, IServiceProvider sp) {
    validators = Maps.newLinkedHashMap();
    for (final IHDLValidator gen : sp.getAllValidators()) {
        final String name = gen.getName();
        validators.put(gen.getErrorClass(), gen);
        info.registeredValidators.put(name, gen);
    }
}

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

private DataSet(String base) {
    this.base = base;
    this.builds = Maps.newLinkedHashMap();
    this.namespaces = Maps.newLinkedHashMap();
}

From source file:org.apache.brooklyn.util.core.task.AbstractExecutionContext.java

/** @see #submit(Map, Runnable) */
@Override
public Task<?> submit(Runnable runnable) {
    return submitInternal(Maps.newLinkedHashMap(), runnable);
}

From source file:org.jpmml.postgresql.PMMLUtil.java

static private Map<FieldName, FieldValue> loadStruct(Evaluator evaluator, ResultSet request)
        throws SQLException {
    Map<FieldName, FieldValue> result = Maps.newLinkedHashMap();

    Map<String, Integer> columns = parseColumns(request);

    Iterable<FieldName> fields = evaluator.getActiveFields();
    for (FieldName field : fields) {
        String label = normalize(field.getValue());

        Integer column = columns.get(label);
        if (column == null) {
            continue;
        }/*  w w w.j a  va2  s  .c  o  m*/

        FieldValue value = EvaluatorUtil.prepare(evaluator, field, request.getObject(column));

        result.put(field, value);
    }

    return result;
}

From source file:brooklyn.event.feed.jmx.JmxValueFunctions.java

public static Map<List<?>, Map<String, Object>> tabularDataToMapOfMaps(TabularData table) {
    Map<List<?>, Map<String, Object>> result = Maps.newLinkedHashMap();
    for (Object k : table.keySet()) {
        final Object[] kValues = ((List<?>) k).toArray();
        CompositeData v = (CompositeData) table.get(kValues);
        result.put((List<?>) k, compositeDataToMap(v));
    }/*from www .ja va 2s.  c  o  m*/
    return result;
}

From source file:eu.numberfour.n4js.ts.scoping.builtin.EnumerableScope.java

/**
 * Create the map of descriptions that make up this scope.
 *///w ww.  j a  v a2 s . c  o m
protected final Map<QualifiedName, IEObjectDescription> createElements() {
    Map<QualifiedName, IEObjectDescription> result = Maps.newLinkedHashMap();
    descriptor.processResources(getFileNames(), (r) -> buildMap(r, result));
    return result;
}

From source file:org.apache.brooklyn.util.core.xstream.ImmutableMapConverter.java

public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
    Map<?, ?> map = Maps.newLinkedHashMap();
    populateMap(reader, context, map);/* w w w  .j a va  2s.com*/
    return ImmutableMap.copyOf(Maps.filterEntries(map, new Predicate<Map.Entry<?, ?>>() {
        @Override
        public boolean apply(Entry<?, ?> input) {
            return input != null && input.getKey() != null && input.getValue() != null;
        }
    }));
}

From source file:com.comphenix.protocol.injector.netty.NettyProtocolRegistry.java

@Override
protected synchronized void initialize() {
    ProtocolLogger.debug("Initializing the Netty protocol registry"); // Debug for issue #202

    Object[] protocols = enumProtocol.getEnumConstants();

    // ID to Packet class maps
    Map<Object, Map<Integer, Class<?>>> serverMaps = Maps.newLinkedHashMap();
    Map<Object, Map<Integer, Class<?>>> clientMaps = Maps.newLinkedHashMap();

    Register result = new Register();
    StructureModifier<Object> modifier = null;

    // Iterate through the protocols
    for (Object protocol : protocols) {
        if (modifier == null)
            modifier = new StructureModifier<Object>(protocol.getClass().getSuperclass(), false);
        StructureModifier<Map<Object, Map<Integer, Class<?>>>> maps = modifier.withTarget(protocol)
                .withType(Map.class);
        for (Entry<Object, Map<Integer, Class<?>>> entry : maps.read(0).entrySet()) {
            String direction = entry.getKey().toString();
            if (direction.contains("CLIENTBOUND")) { // Sent by Server
                serverMaps.put(protocol, entry.getValue());
            } else if (direction.contains("SERVERBOUND")) { // Sent by Client
                clientMaps.put(protocol, entry.getValue());
            }//w  w w.j a v a 2  s  . c  om
        }
    }

    // Maps we have to occasionally check have changed
    for (Map<Integer, Class<?>> map : serverMaps.values()) {
        result.containers.add(new MapContainer(map));
    }

    for (Map<Integer, Class<?>> map : clientMaps.values()) {
        result.containers.add(new MapContainer(map));
    }

    for (int i = 0; i < protocols.length; i++) {
        Object protocol = protocols[i];
        Enum<?> enumProtocol = (Enum<?>) protocol;
        Protocol equivalent = Protocol.fromVanilla(enumProtocol);

        // Associate known types
        if (serverMaps.containsKey(protocol))
            associatePackets(result, serverMaps.get(protocol), equivalent, Sender.SERVER);
        if (clientMaps.containsKey(protocol))
            associatePackets(result, clientMaps.get(protocol), equivalent, Sender.CLIENT);
    }

    // Exchange (thread safe, as we have only one writer)
    this.register = result;
}

From source file:org.jclouds.atmos.domain.UserMetadata.java

public UserMetadata() {
    this.metadata = Maps.newLinkedHashMap();
    this.listableMetadata = Maps.newLinkedHashMap();
    this.tags = Sets.newLinkedHashSet();
    this.listableTags = Sets.newLinkedHashSet();
}

From source file:org.ldp4j.example.InMemoryContainerHandler.java

protected InMemoryContainerHandler(String handlerName) {
    super(handlerName);
    this.nameProviders = Maps.newLinkedHashMap();
}