Example usage for com.google.common.collect ArrayListMultimap create

List of usage examples for com.google.common.collect ArrayListMultimap create

Introduction

In this page you can find the example usage for com.google.common.collect ArrayListMultimap create.

Prototype

public static <K, V> ArrayListMultimap<K, V> create(int expectedKeys, int expectedValuesPerKey) 

Source Link

Document

Constructs an empty ArrayListMultimap with enough capacity to hold the specified numbers of keys and values without resizing.

Usage

From source file:net.shibboleth.idp.profile.context.AuditContext.java

/** Constructor. */
public AuditContext() {
    fieldMap = ArrayListMultimap.create(20, 1);
}

From source file:yaphyre.core.films.ImageFile.java

public ImageFile(int xResolution, int yResolution) {
    this.xResolution = xResolution;
    this.yResolution = yResolution;

    samples = ArrayListMultimap.create(xResolution * yResolution, 1);
}

From source file:org.sonar.ce.taskprocessor.CeTaskProcessorRepositoryImpl.java

private static Multimap<String, CeTaskProcessor> buildPermissiveCeTaskProcessorIndex(
        CeTaskProcessor[] taskProcessors) {
    Multimap<String, CeTaskProcessor> permissiveIndex = ArrayListMultimap.create(taskProcessors.length, 1);
    for (CeTaskProcessor taskProcessor : taskProcessors) {
        for (String ceTaskType : taskProcessor.getHandledCeTaskTypes()) {
            permissiveIndex.put(ceTaskType, taskProcessor);
        }/* w  w w.j a v a  2  s.c  o m*/
    }
    return permissiveIndex;
}

From source file:com.cloudera.cdk.morphline.api.Record.java

/** Returns a shallow copy of this record. */
public Record copy() {
    //return new Record(ArrayListMultimap.create(fields)); // adding fields later causes (slow) rehashing
    ArrayListMultimap copy = ArrayListMultimap.create(fields.size() + 16, 10);
    copy.putAll(fields);/*from   ww  w  .j av  a2s  .  c o  m*/
    return new Record(copy);
}

From source file:org.kitesdk.morphline.api.Record.java

/** Returns a shallow copy of this record. */
public Record copy() {
    //return new Record(ArrayListMultimap.create(fields)); // adding fields later causes (slow) rehashing
    ArrayListMultimap<String, Object> copy = ArrayListMultimap.create(fields.size() + 16, 10);
    copy.putAll(fields);/*from  w w w.  j  av a 2 s. c  o  m*/
    return new Record(copy);
}

From source file:eu.esdihumboldt.cst.functions.core.join.JoinUtil.java

/**
 * Build the join table and joined properties maps based on the given join
 * parameter/*from w ww.  j a v a2 s  .  c o  m*/
 * 
 * @param joinParameter The join parameter
 * @return A {@link JoinDefinition} containing the join table and joined
 *         properties maps
 */
public static JoinDefinition getJoinDefinition(JoinParameter joinParameter) {
    JoinDefinition result = new JoinDefinition(joinParameter.getTypes().size());

    for (JoinCondition condition : joinParameter.getConditions()) {
        int baseTypeIndex = joinParameter.getTypes()
                .indexOf(AlignmentUtil.getTypeEntity(condition.baseProperty));
        int joinTypeIndex = joinParameter.getTypes()
                .indexOf(AlignmentUtil.getTypeEntity(condition.joinProperty));
        Multimap<Integer, JoinCondition> typeTable = result.joinTable.get(joinTypeIndex);
        if (typeTable == null) {
            typeTable = ArrayListMultimap.create(2, 2);
            result.joinTable.put(joinTypeIndex, typeTable);
        }
        typeTable.put(baseTypeIndex, condition);

        // update highest type if necessary
        if (result.directParent[joinTypeIndex] < baseTypeIndex) {
            result.directParent[joinTypeIndex] = baseTypeIndex;
        }

        result.properties.put(condition.joinProperty.getType(), condition.joinProperty);
        result.baseProperties.put(condition.baseProperty.getType(), condition.baseProperty);
    }

    return result;
}

From source file:eu.esdihumboldt.hale.common.scripting.transformation.AbstractSingleTargetScriptedPropertyTransformation.java

@Override
protected ListMultimap<String, Object> evaluateImpl(String transformationIdentifier, E engine,
        ListMultimap<String, PropertyValue> variables,
        ListMultimap<String, PropertyEntityDefinition> resultNames, Map<String, String> executionParameters,
        TransformationLog log) throws TransformationException {
    assert resultNames.size() == 1;
    Entry<String, PropertyEntityDefinition> entry = resultNames.entries().iterator().next();
    ListMultimap<String, Object> resultMap = ArrayListMultimap.create(1, 1);
    try {//www . j a  v a2 s . com
        Object result = evaluate(transformationIdentifier, engine, variables, entry.getKey(), entry.getValue(),
                executionParameters, log);
        resultMap.put(entry.getKey(), result);
    } catch (NoResultException e) {
        // no result returned
        // /TODO warning? or ignore?
    }
    return resultMap;
}

From source file:net.shibboleth.idp.session.context.LogoutContext.java

/** Constructor. */
public LogoutContext() {
    sessionMap = ArrayListMultimap.create(10, 1);
    keyedSessionMap = new HashMap<>();
}

From source file:eu.esdihumboldt.hale.common.align.transformation.function.impl.AbstractSingleTargetPropertyTransformation.java

/**
 * @see AbstractPropertyTransformation#evaluate(String,
 *      TransformationEngine, ListMultimap, ListMultimap, Map,
 *      TransformationLog)//from   w  w  w.  java 2s  .c  o  m
 */
@Override
protected ListMultimap<String, Object> evaluate(String transformationIdentifier, E engine,
        ListMultimap<String, PropertyValue> variables,
        ListMultimap<String, PropertyEntityDefinition> resultNames, Map<String, String> executionParameters,
        TransformationLog log) throws TransformationException {
    assert resultNames.size() == 1;
    Entry<String, PropertyEntityDefinition> entry = resultNames.entries().iterator().next();
    ListMultimap<String, Object> resultMap = ArrayListMultimap.create(1, 1);
    try {
        Object result = evaluate(transformationIdentifier, engine, variables, entry.getKey(), entry.getValue(),
                executionParameters, log);
        resultMap.put(entry.getKey(), result);
    } catch (NoResultException e) {
        // no result returned
        // /TODO warning? or ignore?
    }
    return resultMap;
}

From source file:com.ngdata.sep.impl.SepEventExecutor.java

public SepEventExecutor(EventListener eventListener, List<ThreadPoolExecutor> executors, int batchSize,
        SepMetrics sepMetrics) {/* www  .j  a  v  a  2s .c  om*/
    this.eventListener = eventListener;
    this.executors = executors;
    this.numThreads = executors.size();
    this.batchSize = batchSize;
    this.sepMetrics = sepMetrics;
    eventBuffers = ArrayListMultimap.create(numThreads, batchSize);
    futures = Lists.newArrayList();
}