List of usage examples for com.google.common.collect Lists newArrayListWithExpectedSize
@GwtCompatible(serializable = true) public static <E> ArrayList<E> newArrayListWithExpectedSize(int estimatedSize)
From source file:com.android.tools.idea.tests.gui.framework.fixture.TranslationsEditorFixture.java
@NotNull public List<String> keys() { String[][] contents = myTable.contents(); List<String> keys = Lists.newArrayListWithExpectedSize(contents.length); for (String[] content : contents) { keys.add(content[0]);// w w w. j av a2 s . c o m } return keys; }
From source file:io.hops.metadata.ndb.dalimpl.hdfs.UserGroupClusterj.java
@Override public void addUserToGroups(int userId, List<Integer> groupIds) throws StorageException { HopsSession session = connector.obtainSession(); List<UserGroupDTO> dtos = Lists.newArrayListWithExpectedSize(groupIds.size()); for (int groupId : groupIds) { UserGroupDTO dto = session.newInstance(UserGroupDTO.class); dto.setUserId(userId);/*w ww . ja v a2s. c o m*/ dto.setGroupId(groupId); dtos.add(dto); } session.savePersistentAll(dtos); session.release(dtos); }
From source file:org.axdt.flex4.debugger.model.FlexStackFrame.java
public IVariable[] getVariables() throws DebugException { if (!isSuspended()) return EMPTY_VARIABLES; if (cachedVariables == null) { try {/*from www . ja va 2 s . com*/ Session session = thread.getSession(); Variable[] arguments = frame.getArguments(session); Variable[] locals = frame.getLocals(session); List<IVariable> result = Lists.newArrayListWithExpectedSize(locals.length + arguments.length + 1); Variable this1 = frame.getThis(session); if (this1 != null) result.add(new FlexVariable(thread, this1)); for (Variable var : arguments) { result.add(new FlexVariable(thread, var)); } for (Variable var : locals) { result.add(new FlexVariable(thread, var)); } cachedVariables = result.toArray(new IVariable[result.size()]); } catch (PlayerDebugException e) { throw debugError(e); } } return cachedVariables; }
From source file:net.sourceforge.ganttproject.chart.gantt.ClipboardTaskProcessor.java
private List<Task> pasteAsChild(Task pasteRoot, Task anchor, ClipboardContents clipboardContents) { List<Task> result = Lists.newArrayListWithExpectedSize(clipboardContents.getTasks().size()); Map<Task, Task> original2copy = Maps.newHashMap(); for (Task task : clipboardContents.getTasks()) { Task copy = copyAndInsert(task, pasteRoot, anchor, original2copy, clipboardContents); anchor = copy;/*from w w w . jav a 2s . c o m*/ result.add(copy); } copyDependencies(clipboardContents, original2copy); copyAssignments(clipboardContents, original2copy); return result; }
From source file:org.dishevelled.bio.align.BiojavaPairwiseAlignment.java
@Override public Iterable<AlignmentPair> local(final List<Sequence> queries, final List<Sequence> subjects, final GapPenalties gapPenalties) { checkNotNull(queries);//w ww . ja va2 s .co m checkNotNull(subjects); checkNotNull(gapPenalties); if (queries.isEmpty() || subjects.isEmpty()) { return Collections.<AlignmentPair>emptyList(); } SmithWaterman smithWaterman = new SmithWaterman(gapPenalties.getMatch(), gapPenalties.getReplace(), gapPenalties.getInsert(), gapPenalties.getDelete(), gapPenalties.getExtend(), getSubstitutionMatrix()); List<AlignmentPair> alignmentPairs = Lists.newArrayListWithExpectedSize(queries.size() * subjects.size()); for (Sequence query : queries) { for (Sequence subject : subjects) { AlignmentPair alignmentPair = smithWaterman.pairwiseAlignment(query, subject); alignmentPairs.add(alignmentPair); } } return alignmentPairs; }
From source file:com.mgmtp.jfunk.data.generator.control.EnumerationControl.java
@Override protected List<FieldCase> createCases() { List<FieldCase> fieldCases = Lists.newArrayListWithExpectedSize(cases.size()); for (FieldCase fieldCase : cases) { fieldCases.add(createCase(fieldCase)); }/*from w w w .j a v a 2s . co m*/ return fieldCases; }
From source file:com.google.visualization.datasource.query.QuerySort.java
/** * Returns a list of columns held by this query sort. * * @return A list of columns held by this query sort. */// w w w. j a v a 2 s. c om public List<AbstractColumn> getColumns() { List<AbstractColumn> result = Lists.newArrayListWithExpectedSize(sortColumns.size()); for (ColumnSort columnSort : sortColumns) { result.add(columnSort.getColumn()); } return result; }
From source file:com.webbfontaine.valuewebb.irms.worker.GParsWorkerPool.java
protected List<Actor> createWorkers(PGroup pGroup) { int workersPoolSize = workerFactory.getWorkersPoolSize(); List<Actor> actors = Lists.newArrayListWithExpectedSize(workersPoolSize); for (int index = 0; index < workersPoolSize; index++) { DynamicDispatchActor actor = createDispatchActor(pGroup); actor.start();/*from ww w . j ava2s . c o m*/ actors.add(actor); } return actors; }
From source file:com.android.tools.lint.psi.EcjPsiClassType.java
@NonNull @Override//from w ww . j a va 2 s . c o m public PsiType[] getParameters() { if (mReferenceBinding instanceof ParameterizedTypeBinding) { ParameterizedTypeBinding binding = (ParameterizedTypeBinding) mReferenceBinding; TypeBinding[] bindings = binding.arguments; if (bindings != null && bindings.length > 0) { List<PsiType> types = Lists.newArrayListWithExpectedSize(bindings.length); for (TypeBinding b : bindings) { PsiType type = mManager.findType(b); if (type != null) { types.add(type); } } return types.toArray(PsiType.EMPTY_ARRAY); } } return PsiType.EMPTY_ARRAY; }
From source file:org.apache.hadoop.hdfs.server.namenode.LogOpGenerator.java
/** * Instantiates pseudo-random edit log sequence generator. * @param numFiles Total number of distinct files * @param blocksPerFile Total number of distinct blocks per file *///from www. j a va 2s. c om public LogOpGenerator(int numFiles, int blocksPerFile) { this.numFiles = numFiles; this.blocksPerFile = blocksPerFile; numOpsPossible = numFiles * OPS_PER_FILE; possibleOps = Lists.newArrayListWithExpectedSize(numOpsPossible); random = new Random(); inodeId = new INodeId(); init(); }