List of usage examples for com.google.common.collect Maps newHashMapWithExpectedSize
public static <K, V> HashMap<K, V> newHashMapWithExpectedSize(int expectedSize)
From source file:org.gradoop.model.impl.operators.matching.common.functions.ElementsFromEmbedding.java
/** * Constructor/* w ww. j a v a2 s . c om*/ * * @param traversalCode traversal code to retrieve sourceId/targetId * @param graphHeadFactory EPGM graph head factory * @param vertexFactory EPGM vertex factory * @param edgeFactory EPGM edge factory */ public ElementsFromEmbedding(TraversalCode traversalCode, EPGMGraphHeadFactory<G> graphHeadFactory, EPGMVertexFactory<V> vertexFactory, EPGMEdgeFactory<E> edgeFactory) { this.graphHeadFactory = graphHeadFactory; this.vertexFactory = vertexFactory; this.edgeFactory = edgeFactory; List<Step> steps = traversalCode.getSteps(); edgeToStep = Maps.newHashMapWithExpectedSize(steps.size()); for (Step step : steps) { edgeToStep.put((int) step.getVia(), step); } }
From source file:org.jasig.ssp.util.collections.Pair.java
public Map<T, U> toMap() { Map<T, U> map = Maps.newHashMapWithExpectedSize(1); map.put(first, second); return map; }
From source file:com.romeikat.datamessie.core.base.ui.component.DocumentProcessingStateChoiceProvider.java
private Map<Integer, DocumentProcessingState> getStates() { final DocumentProcessingState[] states = DocumentProcessingState.values(); final Map<Integer, DocumentProcessingState> statesMap = Maps.newHashMapWithExpectedSize(states.length); for (final DocumentProcessingState state : states) { statesMap.put(state.ordinal(), state); }//w ww .ja v a2s. c o m return statesMap; }
From source file:com.opengamma.master.security.SecurityLoaderResult.java
/** * Gets the result map in terms of {@code ObjectId}. * //w ww . ja va2 s . c om * @return the map of object identifiers, not null */ public Map<ExternalIdBundle, ObjectId> getResultMapAsObjectId() { Map<ExternalIdBundle, ObjectId> resultMap = Maps.newHashMapWithExpectedSize(getResultMap().size()); for (Entry<ExternalIdBundle, UniqueId> entry : getResultMap().entrySet()) { resultMap.put(entry.getKey(), entry.getValue().getObjectId()); } return resultMap; }
From source file:net.minecrell.quartz.launch.transformers.DeobfuscationTransformer.java
protected DeobfuscationTransformer(Mappings mappings) { this.mappings = requireNonNull(mappings, "mappings"); this.methods = Maps.newHashMapWithExpectedSize(mappings.getMethods().size()); this.fields = Maps.newHashMapWithExpectedSize(mappings.getFields().size()); }
From source file:org.eclipse.xtext.ui.editor.StatefulResourceDescription.java
protected ImmutableList<IEObjectDescription> copyExportedObjects(IResourceDescription original) { return ImmutableList.copyOf(Iterables.filter(Iterables.transform(original.getExportedObjects(), new Function<IEObjectDescription, IEObjectDescription>() { @Override/* w ww .jav a2 s . c om*/ public IEObjectDescription apply(IEObjectDescription from) { if (from == null) return null; EObject proxy = from.getEObjectOrProxy(); if (proxy == null) return null; if (proxy.eIsProxy()) return from; InternalEObject result = (InternalEObject) EcoreUtil.create(from.getEClass()); result.eSetProxyURI(EcoreUtil.getURI(from.getEObjectOrProxy())); Map<String, String> userData = null; for (String key : from.getUserDataKeys()) { if (userData == null) { userData = Maps.newHashMapWithExpectedSize(2); } userData.put(key, from.getUserData(key)); } return EObjectDescription.create(from.getName(), result, userData); } }), Predicates.notNull())); }
From source file:org.sonar.server.metric.persistence.MetricDao.java
public List<MetricDto> selectEnabled(DbSession session, @Nullable Boolean isCustom, SearchOptions searchOptions) {/* ww w .j a v a2 s.com*/ Map<String, Object> properties = Maps.newHashMapWithExpectedSize(1); if (isCustom != null) { properties.put("isCustom", isCustom); } return mapper(session).selectAllEnabled(properties, new RowBounds(searchOptions.getOffset(), searchOptions.getLimit())); }
From source file:org.spongepowered.api.event.SpongeEventFactoryUtils.java
/** * Creates a new {@link GameStateEvent} of the given type. * * @param type The type of the state event * @param game The game instance for this {@link GameEvent} * @param <T> The type of the state event * @return A new instance of the event/*from w ww . ja va2 s .c o m*/ */ public static <T extends GameStateEvent> T createState(Class<T> type, Game game) { Map<String, Object> values = Maps.newHashMapWithExpectedSize(1); values.put("game", game); values.put("state", game.getState()); return SpongeEventFactoryUtils.createEventImpl(type, values); }
From source file:com.romeikat.datamessie.core.base.dao.impl.CrawlingDao.java
public Map<Document, Crawling> getForDocuments(final SharedSessionContract ssc, final Collection<Document> documents) { final Set<Long> crawlingIds = documents.stream().map(d -> d.getCrawlingId()).collect(Collectors.toSet()); final Map<Long, Crawling> crawlingsById = getIdsWithEntities(ssc, crawlingIds); final Map<Document, Crawling> result = Maps.newHashMapWithExpectedSize(documents.size()); for (final Document document : documents) { final Crawling crawling = crawlingsById.get(document.getCrawlingId()); result.put(document, crawling);//from w w w.j a v a2 s. c om } return result; }
From source file:com.qcadoo.mes.basic.ShiftsServiceImpl.java
private static Map<Integer, String> buildDayNumToNameMap() { Map<Integer, String> dayNumsToDayName = Maps.newHashMapWithExpectedSize(7); dayNumsToDayName.put(Calendar.MONDAY, L_MONDAY); dayNumsToDayName.put(Calendar.TUESDAY, L_TUESDAY); dayNumsToDayName.put(Calendar.WEDNESDAY, L_WENSDAY); dayNumsToDayName.put(Calendar.THURSDAY, L_THURSDAY); dayNumsToDayName.put(Calendar.FRIDAY, L_FRIDAY); dayNumsToDayName.put(Calendar.SATURDAY, L_SATURDAY); dayNumsToDayName.put(Calendar.SUNDAY, L_SUNDAY); return Collections.unmodifiableMap(dayNumsToDayName); }