Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 src/main/java/org/dataloader/BatchLoaderEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public <K> Builder keyContexts(List<K> keys, List<Object> keyContexts) {
Assertions.nonNull(keyContexts);

Map<Object, Object> map = new HashMap<>();
List<Object> list = new ArrayList<>();
List<Object> list = new ArrayList<>(keys.size());
for (int i = 0; i < keys.size(); i++) {
K key = keys.get(i);
Object keyContext = null;
Expand Down
2 changes: 1 addition & 1 deletion 2 src/main/java/org/dataloader/DataLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ public CompletableFuture<List<V>> loadMany(List<K> keys, List<Object> keyContext
nonNull(keyContexts);

synchronized (this) {
List<CompletableFuture<V>> collect = new ArrayList<>();
List<CompletableFuture<V>> collect = new ArrayList<>(keys.size());
for (int i = 0; i < keys.size(); i++) {
K key = keys.get(i);
Object keyContext = null;
Expand Down
4 changes: 2 additions & 2 deletions 4 src/main/java/org/dataloader/DataLoaderHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ DispatchResult<V> dispatch() {
private CompletableFuture<List<V>> sliceIntoBatchesOfBatches(List<K> keys, List<CompletableFuture<V>> queuedFutures, List<Object> callContexts, int maxBatchSize) {
// the number of keys is > than what the batch loader function can accept
// so make multiple calls to the loader
List<CompletableFuture<List<V>>> allBatches = new ArrayList<>();
int len = keys.size();
int batchCount = (int) Math.ceil(len / (double) maxBatchSize);
List<CompletableFuture<List<V>>> allBatches = new ArrayList<>(batchCount);
for (int i = 0; i < batchCount; i++) {

int fromIndex = i * maxBatchSize;
Expand Down Expand Up @@ -477,7 +477,7 @@ private CompletableFuture<List<V>> invokeMapBatchLoader(List<K> keys, BatchLoade
}
CompletableFuture<Map<K, V>> mapBatchLoad = nonNull(loadResult, () -> "Your batch loader function MUST return a non null CompletionStage").toCompletableFuture();
return mapBatchLoad.thenApply(map -> {
List<V> values = new ArrayList<>();
List<V> values = new ArrayList<>(keys.size());
for (K key : keys) {
V value = map.get(key);
values.add(value);
Expand Down
2 changes: 1 addition & 1 deletion 2 src/main/java/org/dataloader/ValueCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ default CompletableFuture<List<Try<V>>> getValues(List<K> keys) throws ValueCach
* @throws ValueCachingNotSupported if this cache wants to short-circuit this method completely
*/
default CompletableFuture<List<V>> setValues(List<K> keys, List<V> values) throws ValueCachingNotSupported {
List<CompletableFuture<V>> cacheSets = new ArrayList<>();
List<CompletableFuture<V>> cacheSets = new ArrayList<>(keys.size());
for (int i = 0; i < keys.size(); i++) {
K k = keys.get(i);
V v = values.get(i);
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.