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.dilipkumarg.qb.core.InsertableQueryBuilder.java

protected InsertableQueryBuilder(SqlTable table) {
    super(table);
    // Arguments order is important so creating LinkedHashMap.
    arguments = Maps.newLinkedHashMap();
}

From source file:com.indeed.lsmtree.recordcache.tools.OperationLogCat.java

public static <K, V> void cat(File file, CompressionCodec codec, Serializer<K> keySerizlizer,
        Serializer<V> valueSerializer, Serializer<Collection<K>> keyCollectionSerializer,
        Stringifier<K> keyStringifier, Stringifier<V> valueStringifier) throws IOException {
    OperationSerializer<K, V> serializer = new OperationSerializer<K, V>(keySerizlizer, valueSerializer,
            keyCollectionSerializer);/*from  w  w  w  .j a v  a  2 s.  c  o m*/
    BlockCompressedRecordFile<Operation> recordFile = new BlockCompressedRecordFile.Builder(file, serializer,
            codec).build();
    RecordFile.Reader<Operation> reader = recordFile.reader();

    ObjectMapper mapper = new ObjectMapper();
    Map<String, Object> map = Maps.newLinkedHashMap();
    List<K> keys = Lists.newArrayList();
    while (reader.next()) {
        map.clear();
        keys.clear();
        Operation op = reader.get();
        map.put("position", String.valueOf(reader.getPosition()));
        map.put("type", op.getClass().getSimpleName());
        if (op.getClass() == Put.class) {
            Put<K, V> put = (Put<K, V>) op;
            map.put("key", keyStringifier.toString(put.getKey()));
            map.put("value", valueStringifier.toString(put.getValue()));
        } else if (op.getClass() == Delete.class) {
            Delete<K> delete = (Delete<K>) op;
            for (K key : delete.getKeys()) {
                keys.add(key);
            }
            map.put("keys", keys);
        } else if (op.getClass() == Checkpoint.class) {
            Checkpoint checkpoint = (Checkpoint) op;
            map.put("timestamp", checkpoint.getTimestamp());
        }
        System.out.println(mapper.writeValueAsString(map));
    }
}

From source file:tech.beshu.ror.settings.definitions.UserSettingsCollection.java

private UserSettingsCollection(List<UserSettings> userSettings) {
    this.usersSettingsMap = Maps.newLinkedHashMap();
    userSettings.forEach(x -> this.usersSettingsMap.put(x.getUsername(), x));
}

From source file:com.google.api.tools.framework.importers.swagger.aspects.auth.model.SecurityRequirementModel.java

public static Map<String, SecurityRequirementModel> flattenSecurityRequirementModel(
        List<Map<String, SecurityRequirementModel>> securityRequirementsResult) {
    Map<String, SecurityRequirementModel> securityRequirementsResultFlattened = Maps.newLinkedHashMap();
    for (Map<String, SecurityRequirementModel> schemas : securityRequirementsResult) {
        securityRequirementsResultFlattened.putAll(schemas);
    }//from www. j ava2s. c o  m
    return securityRequirementsResultFlattened;
}

From source file:gobblin.metrics.Tagged.java

public Tagged() {
    this.tags = Maps.newLinkedHashMap();
}

From source file:com.zxy.commons.json.JsonObject.java

private JsonObject() {
    jsonMap = Maps.newLinkedHashMap();
}

From source file:de.dennishoersch.util.inspection.impl.collect.ClassFilesCollector.java

Map<String, Entry> getEntries() {
    if (_entries == null) {
        _entries = Maps.newLinkedHashMap();
        collectClassFiles();
    }

    return _entries;
}

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

@Override
public Object invoke(MethodInvocation invocation) throws Throwable {
    final BeforeMore beforeMore = invocation.getMethod().getAnnotation(BeforeMore.class);
    final Before[] befores = beforeMore.value();
    final Map<Method, Object> map = Maps.newLinkedHashMap();
    for (Before before : befores) {
        final Method method = before.value().getMethod(MethodNames.BEFORE, MethodInvocation.class);
        final Object instance = Globals.get(Injector.class).getInstance(before.value());
        map.put(method, instance);/*from   ww w . j a va 2 s . co  m*/
    }

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

    return invocation.proceed();
}

From source file:org.apache.isis.core.commons.configbuilder.PrimerForEnvironmentVariableISIS_OPTS.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 = Lists.newArrayList(Splitter.on("=").splitToList(keyAndValue));

            if (parts.size() >= 2) {
                String key = parts.get(0);
                parts.remove(0);/*from w w w .j  a  va 2  s .  com*/
                final String value = Joiner.on("=").join(parts);

                map.put(key, value);
            }
        }
    }
    return map;
}

From source file:org.jetbrains.kotlin.resolve.calls.inference.ConstraintsUtil.java

@NotNull
public static Collection<TypeSubstitutor> getSubstitutorsForConflictingParameters(
        @NotNull ConstraintSystem constraintSystem) {
    TypeParameterDescriptor firstConflictingParameter = getFirstConflictingParameter(constraintSystem);
    if (firstConflictingParameter == null)
        return Collections.emptyList();

    Collection<KotlinType> conflictingTypes = constraintSystem.getTypeBounds(firstConflictingParameter)
            .getValues();/*from  ww  w  . ja va2s  .  co m*/

    List<Map<TypeConstructor, TypeProjection>> substitutionContexts = Lists.newArrayList();
    for (KotlinType type : conflictingTypes) {
        Map<TypeConstructor, TypeProjection> context = Maps.newLinkedHashMap();
        context.put(firstConflictingParameter.getTypeConstructor(), new TypeProjectionImpl(type));
        substitutionContexts.add(context);
    }

    for (TypeParameterDescriptor typeParameter : constraintSystem.getTypeVariables()) {
        if (typeParameter == firstConflictingParameter)
            continue;

        KotlinType safeType = getSafeValue(constraintSystem, typeParameter);
        for (Map<TypeConstructor, TypeProjection> context : substitutionContexts) {
            TypeProjection typeProjection = new TypeProjectionImpl(safeType);
            context.put(typeParameter.getTypeConstructor(), typeProjection);
        }
    }
    Collection<TypeSubstitutor> typeSubstitutors = Lists.newArrayList();
    for (Map<TypeConstructor, TypeProjection> context : substitutionContexts) {
        typeSubstitutors.add(TypeSubstitutor.create(context));
    }
    return typeSubstitutors;
}