Skip to content

Commit 9b765a0

Browse files
author
Athira M
committed
Change return type and cache regex
1 parent 89ec81c commit 9b765a0

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/main/java/com/google/firebase/remoteconfig/AndCondition.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.google.firebase.remoteconfig.internal.ServerTemplateResponse.AndConditionResponse;
2525
import com.google.firebase.remoteconfig.internal.ServerTemplateResponse.OneOfConditionResponse;
2626

27-
import java.util.ArrayList;
2827
import java.util.List;
2928
import java.util.stream.Collectors;
3029

@@ -49,8 +48,8 @@ final class AndCondition {
4948
}
5049

5150
@NonNull
52-
List<OneOfCondition> getConditions() {
53-
return new ArrayList<>(conditions);
51+
ImmutableList<OneOfCondition> getConditions() {
52+
return conditions;
5453
}
5554

5655
AndConditionResponse toAndConditionResponse() {

src/main/java/com/google/firebase/remoteconfig/ConditionEvaluator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ final class ConditionEvaluator {
4343
private static final int MAX_CONDITION_RECURSION_DEPTH = 10;
4444
private static final Logger logger = LoggerFactory.getLogger(ConditionEvaluator.class);
4545
private static final BigInteger MICRO_PERCENT_MODULO = BigInteger.valueOf(100_000_000L);
46+
private static final Pattern SEMVER_PATTERN = Pattern.compile("^[0-9]+(?:\\.[0-9]+){0,4}$");
4647

4748
/**
4849
* Evaluates server conditions and assigns a boolean value to each condition.
@@ -340,7 +341,6 @@ private List<Integer> parseSemanticVersion(String versionString) {
340341
}
341342

342343
private boolean validateSemanticVersion(String version) {
343-
Pattern pattern = Pattern.compile("^[0-9]+(?:\\.[0-9]+){0,4}$");
344-
return pattern.matcher(version).matches();
344+
return SEMVER_PATTERN.matcher(version).matches();
345345
}
346346
}

src/main/java/com/google/firebase/remoteconfig/OrCondition.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.google.firebase.internal.NonNull;
2424
import com.google.firebase.remoteconfig.internal.ServerTemplateResponse.OneOfConditionResponse;
2525
import com.google.firebase.remoteconfig.internal.ServerTemplateResponse.OrConditionResponse;
26-
import java.util.ArrayList;
2726
import java.util.List;
2827
import java.util.stream.Collectors;
2928

@@ -46,8 +45,8 @@ public OrCondition(@NonNull List<OneOfCondition> conditions) {
4645
}
4746

4847
@NonNull
49-
List<OneOfCondition> getConditions() {
50-
return new ArrayList<>(conditions);
48+
ImmutableList<OneOfCondition> getConditions() {
49+
return conditions;
5150
}
5251

5352
OrConditionResponse toOrConditionResponse() {

0 commit comments

Comments
 (0)