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.jeroensteenbeeke.andalite.java.analyzer.AnalyzedAnnotation.java

public AnalyzedAnnotation(@Nonnull Location location, @Nonnull String type) {
    super(location);
    this.type = type;
    this.annotationValues = Maps.newLinkedHashMap();
}

From source file:com.yahoo.yqlplus.engine.internal.source.IndexedSourceAdapter.java

private static <T> Map<IndexKey, T> createIndexMap(Map<IndexDescriptor, T> methodMap) {
    Map<IndexKey, T> indexes = Maps.newLinkedHashMap();
    for (Map.Entry<IndexDescriptor, T> e : methodMap.entrySet()) {
        indexes.put(IndexKey.of(e.getKey().getColumnNames()), e.getValue());
    }/*from w w w.j  a va 2s .  c  om*/
    return indexes;
}

From source file:io.redlink.sdk.impl.analysis.model.Enhancements.java

Enhancements() {
    this.enhancements = ArrayListMultimap.create();
    this.entities = Maps.newLinkedHashMap();
    languages = Sets.newHashSet();
}

From source file:de.matzefratze123.heavyspleef.persistence.sql.StatisticAccessor.java

@Override
public Map<String, Field> defineSchema() {
    Map<String, Field> schema = Maps.newLinkedHashMap();
    schema.put(ColumnContract.ID, new Field(Type.INT).primaryKey().autoIncrement());
    schema.put(ColumnContract.UUID, new Field(Type.CHAR).length(36).unique());
    schema.put(ColumnContract.WINS, new Field(Type.INT));
    schema.put(ColumnContract.LOSSES, new Field(Type.INT));
    schema.put(ColumnContract.KNOCKOUTS, new Field(Type.INT));
    schema.put(ColumnContract.GAMES_PLAYED, new Field(Type.INT));
    schema.put(ColumnContract.BLOCKS_BROKEN, new Field(Type.INT));
    schema.put(ColumnContract.TIME_PLAYED, new Field(Type.BIGINT));
    schema.put(ColumnContract.RATING, new Field(Type.DOUBLE));

    return schema;
}

From source file:org.apache.brooklyn.location.jclouds.JcloudsLocationResolver.java

private static Map<String, ApiMetadata> getApisMap() {
    Map<String, ApiMetadata> result = Maps.newLinkedHashMap();
    for (ApiMetadata api : Apis.all()) {
        result.put(api.getId(), api);//ww w.j ava2 s  .c o m
    }
    return ImmutableMap.copyOf(result);
}

From source file:org.gradle.external.javadoc.internal.GroupsJavadocOptionFileOption.java

@Override
public GroupsJavadocOptionFileOption duplicate() {
    Map<String, List<String>> duplicateValue = Maps.newLinkedHashMap();
    for (Map.Entry<String, List<String>> entry : value.entrySet()) {
        duplicateValue.put(entry.getKey(), Lists.newArrayList(entry.getValue()));
    }//from   w w  w.j  a v a  2  s.c om
    return new GroupsJavadocOptionFileOption(option, duplicateValue);
}

From source file:com.google.caja.parser.quasiliteral.QuasiNode.java

public Map<String, ParseTreeNode> match(ParseTreeNode specimen) {
    List<ParseTreeNode> specimens = Lists.newArrayList();
    specimens.add(specimen);/* w w w  .j a v  a 2 s  .c  o  m*/
    Map<String, ParseTreeNode> bindings = Maps.newLinkedHashMap();
    return consumeSpecimens(specimens, bindings) ? bindings : null;
}

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

@Override
public Map<Path<?>, Object> createMap(RelationalPath<?> entity, Object bean) {
    try {/* w  w w . j  a v  a  2 s .c  o  m*/
        Map<Path<?>, Object> values = Maps.newLinkedHashMap();
        Class<?> beanClass = bean.getClass();
        Map<String, Path<?>> columns = getColumns(entity);
        // populate in column order
        for (Map.Entry<String, Path<?>> entry : columns.entrySet()) {
            Path<?> path = entry.getValue();
            Field beanField = ReflectionUtils.getFieldOrNull(beanClass, entry.getKey());
            if (beanField != null && !Modifier.isStatic(beanField.getModifiers())) {
                beanField.setAccessible(true);
                Object propertyValue = beanField.get(bean);
                if (propertyValue != null) {
                    values.put(path, propertyValue);
                } else if (withNullBindings && !isPrimaryKeyColumn(entity, path)) {
                    values.put(path, Null.DEFAULT);
                }
            }
        }
        return values;
    } catch (IllegalAccessException e) {
        throw new QueryException(e);
    }
}

From source file:org.mayocat.configuration.gestalt.EntitiesGestaltConfigurationSource.java

@Override
public Object get() {
    Map<String, Map<String, Object>> entities = Maps.newLinkedHashMap();
    for (EntityMeta meta : entityMetaRegistry.getEntities()) {
        Map data = Maps.newHashMap();
        entities.put(meta.getEntityName(), data);
    }// w  w w .  ja va2  s .c om

    Theme theme = context.getTheme();

    if (theme != null) {
        addAddons(entities, theme.getDefinition().getAddons(), AddonSource.THEME);
        addModels(entities, theme.getDefinition().getModels());
        addImageFormats(entities, theme.getDefinition().getImageFormats(), AddonSource.THEME);
        addTypes(entities, theme.getDefinition().getProductTypes());
    }

    addAddons(entities, platformSettings.getAddons(), AddonSource.PLATFORM);
    addImageFormats(entities, platformSettings.getImages(), AddonSource.PLATFORM);
    addModels(entities, platformSettings.getModels());

    for (String entity : entities.keySet()) {
        for (EntityConfigurationContributor contributor : contributors.values()) {
            if (contributor.contributesTo().equals(entity)) {
                contributor.contribute(entities.get(entity));
            }
        }
    }

    return entities;
}

From source file:org.eclipse.emf.compare.ide.ui.internal.actions.group.MetamodelGroupProvider.java

/**
 * {@inheritDoc}//from  w ww .j  a v a  2 s.  co  m
 * 
 * @see org.eclipse.emf.compare.ide.ui.internal.actions.group.DifferenceGroupProvider#getGroups(org.eclipse.emf.compare.Comparison)
 */
public Iterable<? extends DifferenceGroup> getGroups(Comparison comparison) {
    final List<Diff> diffs = comparison.getDifferences();

    final Map<EClass, List<Diff>> diffByEClass = Maps.newLinkedHashMap();
    for (Diff candidate : diffs) {
        final EClass target;
        if (candidate instanceof ReferenceChange) {
            if (((ReferenceChange) candidate).getReference().isContainment()) {
                final EObject parentMatch = candidate.getMatch().eContainer();
                if (parentMatch instanceof Match) {
                    target = findEClass((Match) parentMatch);
                } else {
                    target = findEClass(candidate.getMatch());
                }
            } else {
                target = findEClass(candidate.getMatch());
            }
        } else if (candidate instanceof AttributeChange) {
            target = findEClass(candidate.getMatch());
        } else {
            // Ignore this possibility for now.
            continue;
        }

        List<Diff> diffsForEClass = diffByEClass.get(target);
        if (diffsForEClass == null) {
            diffsForEClass = Lists.newArrayList();
            diffByEClass.put(target, diffsForEClass);
        }
        diffsForEClass.add(candidate);
    }

    final List<DifferenceGroup> groups = Lists.newArrayList();
    for (Map.Entry<EClass, List<Diff>> entry : diffByEClass.entrySet()) {
        groups.add(new DefaultDifferenceGroup(comparison, entry.getValue(), alwaysTrue(),
                entry.getKey().getName()));
    }

    return groups;
}