Skip to content

Commit 3a61859

Browse files
committed
removed usage of removeIf
1 parent 48c9494 commit 3a61859

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.44.2]
5+
6+
### Fixed
7+
- Removed usage of removeIf, to support API < 26 without using coreLibraryDesugaring
8+
49
## [0.44.1]
510

611
### Added

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ allprojects {
3131
}
3232

3333
project.ext {
34-
sdkVersion='0.44.1'
34+
sdkVersion='0.44.2'
3535
versionCode=1
3636

3737
compileSdkVersion=30

core/src/main/java/io/snabble/sdk/Project.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
import java.util.Collections;
1818
import java.util.Currency;
1919
import java.util.HashMap;
20+
import java.util.Iterator;
2021
import java.util.List;
2122
import java.util.Locale;
2223
import java.util.Map;
24+
import java.util.Objects;
2325
import java.util.Set;
2426
import java.util.concurrent.CopyOnWriteArrayList;
2527
import java.util.function.Predicate;
@@ -212,9 +214,13 @@ void parse(JsonObject jsonObject) {
212214
if (descriptors != null) {
213215
Type t = new TypeToken<List<PaymentMethodDescriptor>>() {}.getType();
214216
List<PaymentMethodDescriptor> paymentMethodDescriptors = GsonHolder.get().fromJson(descriptors, t);
215-
paymentMethodDescriptors.removeIf(paymentMethodDescriptor ->
216-
PaymentMethod.fromString(paymentMethodDescriptor.getId()) == null);
217-
this.paymentMethodDescriptors = Collections.unmodifiableList(paymentMethodDescriptors);
217+
ArrayList<PaymentMethodDescriptor> filteredDescriptors = new ArrayList<>();
218+
for (PaymentMethodDescriptor descriptor : paymentMethodDescriptors) {
219+
if (PaymentMethod.fromString(descriptor.getId()) != null) {
220+
filteredDescriptors.add(descriptor);
221+
}
222+
}
223+
this.paymentMethodDescriptors = Collections.unmodifiableList(filteredDescriptors);
218224
} else {
219225
this.paymentMethodDescriptors = Collections.unmodifiableList(Collections.emptyList());
220226
}

0 commit comments

Comments
 (0)