Example usage for com.google.common.collect Maps newHashMapWithExpectedSize

List of usage examples for com.google.common.collect Maps newHashMapWithExpectedSize

Introduction

In this page you can find the example usage for com.google.common.collect Maps newHashMapWithExpectedSize.

Prototype

public static <K, V> HashMap<K, V> newHashMapWithExpectedSize(int expectedSize) 

Source Link

Document

Creates a HashMap instance, with a high enough "initial capacity" that it should hold expectedSize elements without growth.

Usage

From source file:org.eclipse.hawkbit.ui.artifacts.event.UploadViewAcceptCriteria.java

private static Map<String, Object> createDropHintConfigurations() {
    final Map<String, Object> config = Maps.newHashMapWithExpectedSize(2);
    config.put(UIComponentIdProvider.UPLOAD_TYPE_BUTTON_PREFIX, UploadArtifactUIEvent.SOFTWARE_TYPE_DRAG_START);
    config.put(UIComponentIdProvider.UPLOAD_SOFTWARE_MODULE_TABLE, UploadArtifactUIEvent.SOFTWARE_DRAG_START);
    return config;
}

From source file:org.eclipse.hawkbit.amqp.AmqpDeadletterProperties.java

/**
 * Return the deadletter arguments.//from   w ww  . ja  v a  2 s  .  c  o  m
 * 
 * @param exchange
 *            the deadletter exchange
 * @return map which holds the properties
 */
public Map<String, Object> getDeadLetterExchangeArgs(final String exchange) {
    final Map<String, Object> args = Maps.newHashMapWithExpectedSize(1);
    args.put("x-dead-letter-exchange", exchange);
    return args;
}

From source file:org.apache.phoenix.end2end.BaseClientManagedTimeIT.java

public static Map<String, String> getDefaultProps() {
    Map<String, String> props = Maps.newHashMapWithExpectedSize(5);
    // Must update config before starting server
    props.put(QueryServices.STATS_USE_CURRENT_TIME_ATTRIB, Boolean.FALSE.toString());
    return props;
}

From source file:org.eclipse.hawkbit.ui.management.event.ManagementViewAcceptCriteria.java

private static Map<String, List<String>> createDropConfigurations() {
    final Map<String, List<String>> config = Maps.newHashMapWithExpectedSize(6);

    // Delete drop area acceptable components
    config.put(UIComponentIdProvider.DELETE_BUTTON_WRAPPER_ID,
            Arrays.asList(SPUIDefinitions.TARGET_TAG_ID_PREFIXS, UIComponentIdProvider.TARGET_TABLE_ID,
                    SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS, UIComponentIdProvider.DIST_TABLE_ID));

    // Target Tag acceptable components
    config.put(SPUIDefinitions.TARGET_TAG_ID_PREFIXS, Arrays.asList(UIComponentIdProvider.TARGET_TABLE_ID));

    // Target table acceptable components
    config.put(UIComponentIdProvider.TARGET_TABLE_ID,
            Arrays.asList(SPUIDefinitions.TARGET_TAG_ID_PREFIXS, UIComponentIdProvider.DIST_TABLE_ID));

    // Target table header acceptable components
    config.put(UIComponentIdProvider.TARGET_DROP_FILTER_ICON,
            Arrays.asList(UIComponentIdProvider.DIST_TABLE_ID));

    // Distribution table acceptable components
    config.put(UIComponentIdProvider.DIST_TABLE_ID, Arrays.asList(SPUIDefinitions.TARGET_TAG_ID_PREFIXS,
            UIComponentIdProvider.TARGET_TABLE_ID, SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS));

    // Distribution tag acceptable components.
    config.put(SPUIDefinitions.DISTRIBUTION_TAG_ID_PREFIXS, Arrays.asList(UIComponentIdProvider.DIST_TABLE_ID));
    return config;
}

From source file:mod.steamnsteel.inventory.Inventory.java

public Inventory(int size) {
    this.size = size;
    inventory = Maps.newHashMapWithExpectedSize(size);
}

From source file:org.terasology.audio.openAL.BaseSoundPool.java

public BaseSoundPool(int capacity) {
    soundSources = Maps.newHashMapWithExpectedSize(capacity);

    this.fillPool(capacity);
}

From source file:com.opengamma.financial.analytics.fudgemsg.FixedPaymentMatrixBuilder.java

@Override
public FixedPaymentMatrix buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
    final List<FudgeField> dateFields = message.getAllByName(DATES_FIELD);
    final List<FudgeField> mcaFields = message.getAllByName(MCA_FIELD);
    final Map<LocalDate, MultipleCurrencyAmount> values = Maps.newHashMapWithExpectedSize(dateFields.size());
    for (int i = 0; i < dateFields.size(); i++) {
        final LocalDate date = deserializer.fieldValueToObject(LocalDate.class, dateFields.get(i));
        final MultipleCurrencyAmount mca = deserializer.fieldValueToObject(MultipleCurrencyAmount.class,
                mcaFields.get(i));//from  www  .ja v  a 2  s  .  c o  m
        values.put(date, mca);
    }
    final int maxAmounts = message.getInt(MAX_AMOUNTS_FIELD);
    return new FixedPaymentMatrix(values, maxAmounts);
}

From source file:org.sonar.server.rule.index.RuleExtensionDoc.java

public RuleExtensionDoc() {
    super(Maps.newHashMapWithExpectedSize(4));
}

From source file:org.gradoop.flink.algorithms.fsm.transactional.tle.functions.ToTFSMGraph.java

@Override
public TFSMGraph map(GraphTransaction graph) throws Exception {

    Map<GradoopId, Integer> vertexIdMap = Maps.newHashMapWithExpectedSize(graph.getVertices().size());

    Map<Integer, String> fsmVertices = transformVertices(graph, vertexIdMap);

    Map<Integer, FSMEdge> fsmEdges = transformEdges(graph, vertexIdMap);

    return new TFSMGraph(graph.getGraphHead().getId(), fsmVertices, fsmEdges);
}

From source file:com.yahoo.yqlplus.engine.internal.plan.types.base.StringSwitchSequence.java

@Override
public void generate(CodeEmitter code) {
    Map<String, Label> labelMap = Maps.newHashMapWithExpectedSize(sequenceMap.size());
    for (String key : sequenceMap.keySet()) {
        labelMap.put(key, new Label());
    }/*from   w w w .jav a 2s.c o  m*/
    Label done = new Label();
    Label defaultCase = defaultSequence == BytecodeSequence.NOOP ? done : new Label();
    code.exec(input);
    code.emitInstanceCheck(input.getType(), String.class, defaultCase);
    code.emitStringSwitch(labelMap, defaultCase, caseInsensitive);
    MethodVisitor mv = code.getMethodVisitor();
    for (Map.Entry<String, BytecodeSequence> e : sequenceMap.entrySet()) {
        mv.visitLabel(labelMap.get(e.getKey()));
        code.exec(e.getValue());
        mv.visitJumpInsn(Opcodes.GOTO, done);
    }
    if (defaultCase != done) {
        mv.visitLabel(defaultCase);
        code.exec(defaultSequence);
    }
    mv.visitLabel(done);

}