Skip to content

Commit 1649407

Browse files
committed
Functional style
1 parent 3aa0f7f commit 1649407

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

firebase-firestore/src/test/java/com/google/firebase/firestore/local/LocalStoreTestCase.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@
7474
import com.google.firebase.firestore.testutil.TestUtil;
7575
import com.google.firebase.firestore.util.AsyncQueue;
7676
import java.util.ArrayList;
77+
import java.util.Arrays;
7778
import java.util.Collection;
7879
import java.util.Collections;
7980
import java.util.List;
8081
import java.util.Map.Entry;
8182
import java.util.Set;
83+
import java.util.stream.Collectors;
8284
import javax.annotation.Nullable;
8385
import org.junit.After;
8486
import org.junit.Assert;
@@ -161,12 +163,12 @@ private void acknowledgeMutationWithTransformResults(
161163
Collections.singletonList(new MutationResult(version, emptyList()));
162164

163165
if (transformResult.length != 0) {
164-
mutationResults = new ArrayList<>();
165-
for (Object o : transformResult) {
166-
mutationResults.add(
167-
new MutationResult(version, Collections.singletonList(TestUtil.wrap(o))));
168-
}
166+
mutationResults =
167+
Arrays.stream(transformResult)
168+
.map(r -> new MutationResult(version, Collections.singletonList(TestUtil.wrap(r))))
169+
.collect(Collectors.toList());
169170
}
171+
170172
MutationBatchResult result =
171173
MutationBatchResult.create(batch, version, mutationResults, WriteStream.EMPTY_STREAM_TOKEN);
172174
lastChanges = localStore.acknowledgeBatch(result);

0 commit comments

Comments
 (0)