[Android] Add Util to remove a reference from array
Geoffrey Métais
git at videolan.org
Mon Mar 6 16:53:40 CET 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Mar 6 16:24:29 2017 +0100| [7dddb374431f574e7fa77ed3757bc97e2154b975] | committer: Geoffrey Métais
Add Util to remove a reference from array
> https://code.videolan.org/videolan/vlc-android/commit/7dddb374431f574e7fa77ed3757bc97e2154b975
---
vlc-android/src/org/videolan/vlc/util/Util.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/util/Util.java b/vlc-android/src/org/videolan/vlc/util/Util.java
index 39f7646..29d0f4c 100644
--- a/vlc-android/src/org/videolan/vlc/util/Util.java
+++ b/vlc-android/src/org/videolan/vlc/util/Util.java
@@ -84,6 +84,15 @@ public class Util {
return list.size() > 0;
}
+ public static void removeItemInArray(Object[] array, Object item, Object[] destArray) {
+ int offset = 0, count = destArray.length;
+ for (int i = 0; i<count; ++i) {
+ if (array[i].equals(item))
+ offset = 1;
+ destArray[i] = array[i+offset];
+ }
+ }
+
public static void removePositionInArray(Object[] array, int position, Object[] destArray) {
int offset = 0, count = destArray.length;
for (int i = 0; i<count; ++i) {
More information about the Android
mailing list