Skip to content

Commit cf98ca7

Browse files
authored
improve readability (#5032)
1 parent b39de05 commit cf98ca7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/remote/RemoteSerializer.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -654,14 +654,11 @@ StructuredAggregationQuery encodeStructuredAggregationQuery(
654654
int aliasID = 1;
655655
for (AggregateField aggregateField : aggregateFields) {
656656
// The code block below is used to deduplicate the same aggregate fields.
657-
// If two aggregateFields are identical, their aliases would be the same.
658-
// Therefore, when adding duplicated alias into uniqueFields, the size of uniqueFields
659-
// won't increase, and we can skip this aggregateField processing.
660-
final int count = uniqueFields.size();
661-
uniqueFields.add(aggregateField.getAlias());
662-
if (count == uniqueFields.size()) {
657+
if (uniqueFields.contains(aggregateField.getAlias())) {
663658
continue;
664659
}
660+
uniqueFields.add(aggregateField.getAlias());
661+
665662
String serverAlias = "aggregate_" + aliasID++;
666663
aliasMap.put(serverAlias, aggregateField.getAlias());
667664

0 commit comments

Comments
 (0)