List of usage examples for com.google.common.collect Maps newHashMapWithExpectedSize
public static <K, V> HashMap<K, V> newHashMapWithExpectedSize(int expectedSize)
From source file:tachyon.master.file.journal.DeleteMountPointEntry.java
@Override public Map<String, Object> getParameters() { Map<String, Object> parameters = Maps.newHashMapWithExpectedSize(1); parameters.put("tachyonPath", mTachyonPath); return parameters; }
From source file:org.apache.kylin.metadata.model.DynamicFunctionDesc.java
public DynamicFunctionDesc(ParameterDesc parameter, TupleExpression tupleExpression) { this.setParameter(parameter); this.tupleExpression = tupleExpression; Pair<Set<TblColRef>, Set<TblColRef>> colsPair = ExpressionColCollector.collectColumnsPair(tupleExpression); filterColSet = colsPair.getFirst();//w w w.j a va2s .co m Set<TblColRef> measureColumns = colsPair.getSecond(); this.runtimeFuncMap = Maps.newHashMapWithExpectedSize(measureColumns.size()); for (TblColRef column : measureColumns) { runtimeFuncMap.put(column, constructRuntimeFunction(column)); } }
From source file:org.eclipse.hawkbit.amqp.AmqpDeadletterProperties.java
private Map<String, Object> getTTLArgs() { final Map<String, Object> args = Maps.newHashMapWithExpectedSize(1); args.put("x-message-ttl", getTtl()); return args;/*w w w . ja v a 2s. co m*/ }
From source file:org.auraframework.impl.root.component.IfProvider.java
@Override public ComponentConfig provide() throws QuickFixException { AuraContext context = Aura.getContextService().getCurrentContext(); BaseComponent<?, ?> component = context.getCurrentComponent(); InstanceStack iStack = context.getInstanceStack(); ComponentConfig cc = new ComponentConfig(); List<Component> components = new ArrayList<Component>(); Map<String, Object> m = Maps.newHashMapWithExpectedSize(1); m.put("body", components); cc.setAttributes(m);/*w ww . j a va 2s .c o m*/ AttributeSet atts = component.getAttributes(); m.put("template", atts.getValue("body")); Object o = atts.getValue("isTrue"); Boolean isTrue = (Boolean) o; ComponentDefRefArrayImpl facet; // get body facet if true, else facet if false if (isTrue != null && isTrue.booleanValue()) { facet = (ComponentDefRefArrayImpl) atts.getValue("body"); } else { facet = (ComponentDefRefArrayImpl) atts.getValue("else"); } if (facet != null) { iStack.setAttributeName("body"); components.addAll(facet.newInstance(atts.getValueProvider())); iStack.clearAttributeName("body"); } return cc; }
From source file:com.android.build.gradle.integration.common.fixture.GetAndroidModelAction.java
@Override public Map<String, AndroidProject> execute(BuildController buildController) { long t1 = System.currentTimeMillis(); GradleBuild gradleBuild = buildController.getBuildModel(); DomainObjectSet<? extends BasicGradleProject> projects = gradleBuild.getProjects(); final int projectCount = projects.size(); Map<String, AndroidProject> modelMap = Maps.newHashMapWithExpectedSize(projectCount); List<BasicGradleProject> projectList = Lists.newArrayList(projects); List<Thread> threads = Lists.newArrayListWithCapacity(CPU_COUNT); List<ModelQuery> queries = Lists.newArrayListWithCapacity(CPU_COUNT); for (int i = 0; i < CPU_COUNT; i++) { ModelQuery modelQuery = new ModelQuery(projectList, buildController); queries.add(modelQuery);//from w w w .j a v a2s .c o m Thread t = new Thread(modelQuery); threads.add(t); t.start(); } for (int i = 0; i < CPU_COUNT; i++) { try { threads.get(i).join(); ModelQuery modelQuery = queries.get(i); modelMap.putAll(modelQuery.getModels()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } long t2 = System.currentTimeMillis(); System.out.println("GetAndroidModelAction: " + (t2 - t1) + "ms"); return modelMap; }
From source file:org.ow2.authzforce.core.pdp.api.DefaultHashCollectionFactory.java
@Override public <K, V> Map<K, V> newUpdatableMap(final int expectedSize) { return Maps.newHashMapWithExpectedSize(expectedSize); }
From source file:org.auraframework.throwable.NoAccessException.java
@Override public Event getEvent() { try {/* www . j ava 2 s . c o m*/ Map<String, Object> attrs = Maps.newHashMapWithExpectedSize(1); attrs.put("redirectURL", redirectURL); return Aura.getInstanceService().getInstance("aura:noAccess", EventDef.class, attrs); } catch (QuickFixException x) { throw new AuraRuntimeException(x); } }
From source file:com.google.devtools.depan.maven.builder.MavenGraphResolver.java
public GraphModel resolveReferences(GraphModel analysisGraph) { Collection<GraphNode> nodes = analysisGraph.getNodes(); Map<String, List<ArtifactElement>> baseMap = Maps.newHashMapWithExpectedSize(nodes.size()); // Build map of known artifact base names to all matching // ArtifactElements. for (GraphNode node : nodes) { if (node instanceof ArtifactElement) { ArtifactElement artifact = (ArtifactElement) node; String baseLabel = artifact.getBaseLabel(); List<ArtifactElement> known = baseMap.get(baseLabel); if (null == known) { known = Lists.newLinkedList(); baseMap.put(baseLabel, known); }//from www .ja v a 2 s .co m known.add(artifact); } } // Use the sets of ArtifactElements from the baseMap to build // the update map for resolvable ArtifactElements. for (List<ArtifactElement> bases : baseMap.values()) { if (bases.size() < 2) { continue; } buildUpdateMap(bases); } // Use the constructed update map to build a graph with all // resolvable ArtifactElement references mapped to their // definitions. return rewriteReferences(analysisGraph); }
From source file:org.jage.platform.component.pico.injector.Parameters.java
public static Map<Parameter, Parameter> fromMap( final Map<IArgumentDefinition, IArgumentDefinition> argumentDefinitions) { Map<Parameter, Parameter> parameters = Maps.newHashMapWithExpectedSize(argumentDefinitions.size()); for (Entry<IArgumentDefinition, IArgumentDefinition> e : argumentDefinitions.entrySet()) { parameters.put(from(e.getKey()), from(e.getValue())); }//from w ww . j a v a 2s. c o m return parameters; }
From source file:org.onos.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder.java
protected ImmutableMapNodeBuilder(final int sizeHint) { if (sizeHint >= 0) { this.value = Maps.newHashMapWithExpectedSize(sizeHint); } else {// ww w .j av a 2 s .c om this.value = new HashMap<>(DEFAULT_CAPACITY); } }