List of usage examples for com.google.common.collect Lists newArrayListWithCapacity
@GwtCompatible(serializable = true) public static <E> ArrayList<E> newArrayListWithCapacity(int initialArraySize)
From source file:pl.porannajava.javnysejm.InternalEntityListBuilder.java
protected List<T> getEntitiesList() { List<T> tempList = Lists.newArrayListWithCapacity(0); if (this.notEmpty) { for (Map<String, String> map : this.getPropertiesArray()) { tempList.add(this.buildElement(map)); }// w w w. j ava 2s . c om } return tempList; }
From source file:org.apache.brooklyn.core.config.external.vault.VaultUserPassExternalConfigSupplier.java
@Override protected String initAndLogIn(Map<String, String> config) { List<String> errors = Lists.newArrayListWithCapacity(2); String username = config.get("username"); if (Strings.isBlank(username)) errors.add("missing configuration 'username'"); String password = config.get("password"); if (Strings.isBlank(username)) errors.add("missing configuration 'password'"); if (!errors.isEmpty()) { String message = String.format("Problem configuration Vault external config supplier '%s': %s", name, Joiner.on(System.lineSeparator()).join(errors)); throw new IllegalArgumentException(message); }//from w ww . j av a 2s. c om String path = "v1/auth/userpass/login/" + username; ImmutableMap<String, String> requestData = ImmutableMap.of("password", password); ImmutableMap<String, String> headers = MINIMAL_HEADERS; JsonObject response = apiPost(path, headers, requestData); return response.getAsJsonObject("auth").get("client_token").getAsString(); }
From source file:com.opengamma.web.analytics.Inliner.java
private static List<ColumnMeta> getLocalDateDoubleLabelledMatrix1DColumnMeta(LocalDateLabelledMatrix1D matrix) { List<ColumnMeta> meta = Lists.newArrayListWithCapacity(matrix.size()); meta.add(new ColumnMeta(matrix.getKeys()[0], matrix.getKeys()[0].toString(), Double.class, LocalDateLabelledMatrix1D.class)); for (int i = 1; i < matrix.size(); i++) { meta.add(new ColumnMeta(matrix.getKeys()[i], matrix.getKeys()[i].toString(), Double.class, null)); }/*from w w w . ja va 2s . c om*/ return meta; }
From source file:works.chatterbox.hooks.ircchannels.channels.modes.AnnotationMode.java
@Override public List<T> getArguments() { return Lists.newArrayListWithCapacity(this.getArgumentLength()); }
From source file:de.matzefratze123.heavyspleef.flag.presets.DelimiterBasedListParser.java
@Override public List<T> parse(String input) throws InputParseException { String[] components = input.split(delimiterRegex); List<T> result = Lists.newArrayListWithCapacity(components.length); for (int i = 0; i < components.length; i++) { T argument = argParser.parseArgument(components[i]); result.add(argument);/* ww w. java 2 s . c o m*/ } return result; }
From source file:org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.java
private static void report(Task task, List<String> messages, TaskStateInternal state) { List<InvalidUserDataException> causes = Lists.newArrayListWithCapacity(messages.size()); for (String message : messages) { causes.add(new InvalidUserDataException(message)); }/* w ww . j a v a 2s . c o m*/ String errorMessage = getMainMessage(task, messages); state.setOutcome(new TaskValidationException(errorMessage, causes)); }
From source file:org.terasology.persistence.typeHandling.SimpleTypeHandler.java
@Override public List<T> deserializeCollection(PersistedData data, DeserializationContext context) { if (data.isArray()) { PersistedDataArray array = data.getAsArray(); List<T> result = Lists.newArrayListWithCapacity(array.size()); for (PersistedData value : array) { result.add(deserialize(value, context)); }/* w ww . j av a 2s .c o m*/ return result; } return Lists.newArrayList(); }
From source file:org.gradle.cache.internal.FixedAgeOldestCacheCleanup.java
@Override protected List<File> findFilesToDelete(final PersistentCache persistentCache, File[] filesEligibleForCleanup) { LOGGER.info("{} remove files older than {}.", persistentCache, new Date(minimumTimestamp)); List<File> filesForDeletion = Lists.newArrayListWithCapacity(filesEligibleForCleanup.length); for (File file : filesEligibleForCleanup) { if (file.lastModified() < minimumTimestamp) { filesForDeletion.add(file);/*from w w w . j a v a2 s .c om*/ } } return filesForDeletion; }
From source file:org.apache.shindig.gadgets.preload.ConcurrentPreloads.java
ConcurrentPreloads(int size) { tasks = Lists.newArrayListWithCapacity(size); }
From source file:org.apache.pulsar.client.util.ExecutorProvider.java
public ExecutorProvider(int numThreads, String threadNamePrefix) { checkArgument(numThreads > 0);/*from w w w .j ava2s .c o m*/ this.numThreads = numThreads; checkNotNull(threadNamePrefix); executors = Lists.newArrayListWithCapacity(numThreads); for (int i = 0; i < numThreads; i++) { executors.add(Executors.newSingleThreadExecutor(new DefaultThreadFactory(threadNamePrefix))); } }