diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock index 83a1ba9..a2f27a9 100644 Binary files a/.gradle/buildOutputCleanup/buildOutputCleanup.lock and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/basejson/build.gradle b/basejson/build.gradle index 6e3f216..c31ef7e 100644 --- a/basejson/build.gradle +++ b/basejson/build.gradle @@ -8,7 +8,7 @@ android { //noinspection ExpiredTargetSdkVersion targetSdkVersion 30 versionCode 19 - versionName "1.2.6.1" + versionName "1.2.6.2" } buildTypes { diff --git a/basejson/src/main/java/com/kongzue/baseokhttp/util/JsonList.java b/basejson/src/main/java/com/kongzue/baseokhttp/util/JsonList.java index 73dea60..3a1847b 100644 --- a/basejson/src/main/java/com/kongzue/baseokhttp/util/JsonList.java +++ b/basejson/src/main/java/com/kongzue/baseokhttp/util/JsonList.java @@ -2,12 +2,14 @@ import org.json.JSONArray; +import java.util.Iterator; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import static com.kongzue.baseokhttp.util.JsonMap.preParsing; import android.content.Context; +import android.util.Log; import com.kongzue.baseokhttp.util.adapter.JsonListAdapter; import com.kongzue.baseokhttp.util.interfaces.JsonMapPreprocessingEvents; @@ -312,7 +314,7 @@ public Object get(int index) { } public JsonMap findJsonMap(String key, Object value) { - if (isNull(key)){ + if (isNull(key)) { return new JsonMap().preBuild(-1, this); } for (int i = 0; i < size(); i++) { @@ -327,7 +329,7 @@ public JsonMap findJsonMap(String key, Object value) { } public int findJsonMapIndex(String key, Object value) { - if (isNull(key)){ + if (isNull(key)) { return -1; } for (int i = 0; i < size(); i++) { @@ -342,7 +344,7 @@ public int findJsonMapIndex(String key, Object value) { } public JsonList findRemove(String key, Object value) { - if (isNull(key)){ + if (isNull(key)) { return this; } for (int i = 0; i < size(); i++) { @@ -376,12 +378,14 @@ public JsonListAdapter createAdapter(Context context, int layoutResId) { } public JsonList preprocessedJsonMapData(JsonMapPreprocessingEvents events) { - for (Object data : new CopyOnWriteArrayList<>(this)) { + Iterator iterator = iterator(); + while (iterator.hasNext()) { + Object data = iterator.next(); if (data instanceof JsonMap) { JsonMap jsonMap = (JsonMap) data; JsonMap result = events.processingData(jsonMap); - if (events.isDeleteWhenDataIsNull() && result==null){ - remove(data); + if (events.isDeleteWhenDataIsNull() && result == null) { + iterator.remove(); } } }