[Android] Fix list updates

Geoffrey Métais git at videolan.org
Wed Dec 20 17:10:13 CET 2017


vlc-android | branch: 2.5.x | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Dec 20 12:39:41 2017 +0100| [bb064e2548a1e8acbb4b095aad26d6e84ea5fe2f] | committer: Geoffrey Métais

Fix list updates

(cherry picked from commit 64bf8cdb4373268a5b09a77510ed493b63229d3e)

> https://code.videolan.org/videolan/vlc-android/commit/bb064e2548a1e8acbb4b095aad26d6e84ea5fe2f
---

 vlc-android/src/org/videolan/vlc/util/Util.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 66f19130c..f1d491d9a 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -156,10 +156,11 @@ public class Util {
         ArrayList<T> newItems = new ArrayList<>();
         outer:
         for (T newItem : items) {
-            for (T oldItem : dataset) {
+            for (int i = 0; i < dataset.size(); ++i) {
+                T oldItem = dataset.get(i);
                 if (newItem.equals(oldItem)) {
                     //noinspection UnusedAssignment
-                    oldItem = newItem;
+                    dataset.set(i, newItem);
                     continue outer;
                 }
             }



More information about the Android mailing list