X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Futils%2FObservableList.java;h=9e44faef76d1578a05d1f8409854ab58ed1575b2;hp=383148fa8b3a3827a32fbd083ccbac345d7b51a4;hb=83cac114e375728080194fb09758b49c50a8119b;hpb=b06a7a291e35add2dfc89313d226c5efd1bae3b3 diff --git a/app/src/main/java/net/ktnx/mobileledger/utils/ObservableList.java b/app/src/main/java/net/ktnx/mobileledger/utils/ObservableList.java index 383148fa..9e44faef 100644 --- a/app/src/main/java/net/ktnx/mobileledger/utils/ObservableList.java +++ b/app/src/main/java/net/ktnx/mobileledger/utils/ObservableList.java @@ -1,26 +1,23 @@ /* * Copyright © 2019 Damyan Ivanov. - * This file is part of Mobile-Ledger. - * Mobile-Ledger is free software: you can distribute it and/or modify it + * This file is part of MoLe. + * MoLe is free software: you can distribute it and/or modify it * under the term of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your opinion), any later version. * - * Mobile-Ledger is distributed in the hope that it will be useful, + * MoLe is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License terms for details. * * You should have received a copy of the GNU General Public License - * along with Mobile-Ledger. If not, see . + * along with MoLe. If not, see . */ package net.ktnx.mobileledger.utils; import android.os.Build; -import android.support.annotation.NonNull; -import android.support.annotation.Nullable; -import android.support.annotation.RequiresApi; import android.util.Log; import java.util.Collection; @@ -35,7 +32,11 @@ import java.util.function.Predicate; import java.util.function.UnaryOperator; import java.util.stream.Stream; -public class ObservableList extends Observable { +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.RequiresApi; + +public class ObservableList extends Observable implements List { private List list; public ObservableList(List list) { this.list = list; @@ -57,6 +58,7 @@ public class ObservableList extends Observable { public boolean contains(@Nullable Object o) { return list.contains(o); } + @NonNull public Iterator iterator() { return list.iterator(); } @@ -76,6 +78,9 @@ public class ObservableList extends Observable { if (result) forceNotify(); return result; } + public T removeQuietly(int index) { + return list.remove(index); + } public boolean containsAll(@NonNull Collection c) { return list.containsAll(c); } @@ -89,6 +94,9 @@ public class ObservableList extends Observable { if (result) forceNotify(); return result; } + public boolean addAllQuietly(int index, Collection c) { + return list.addAll(index, c); + } public boolean removeAll(@NonNull Collection c) { boolean result = list.removeAll(c); if (result) forceNotify();