Skip to content

Commit 3ca7a29

Browse files
committed
Refactor SyncStack to support List interface for item processing, enhancing flexibility in handling various collection types.
1 parent 8ce6fac commit 3ca7a29

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/com/contentstack/sdk/SyncStack.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,13 @@ protected synchronized void setJSON(@NotNull JSONObject jsonobject) {
8383
} else if (itemsObj instanceof JSONObject) {
8484
syncItems = new ArrayList<>();
8585
syncItems.add(sanitizeJson((JSONObject) itemsObj));
86-
} else if (itemsObj instanceof ArrayList) {
87-
ArrayList<?> itemsList = (ArrayList<?>) itemsObj;
86+
} else if (itemsObj instanceof List) {
87+
List<?> itemsList = (List<?>) itemsObj;
8888
syncItems = new ArrayList<>();
8989
for (Object item : itemsList) {
9090
if (item instanceof JSONObject) {
9191
syncItems.add(sanitizeJson((JSONObject) item));
92-
} else if (item instanceof LinkedHashMap) {
93-
// Convert LinkedHashMap to JSONObject
92+
} else if (item instanceof Map) {
9493
JSONObject jsonItem = new JSONObject((Map<?, ?>) item);
9594
syncItems.add(sanitizeJson(jsonItem));
9695
} else {

0 commit comments

Comments
 (0)