Unverified Commit 1822527a authored by AnujSinghal12's avatar AnujSinghal12 Committed by GitHub

Remove if condition converting list-of-lists into dictionary (#2414)

parent bee418e2
...@@ -122,17 +122,8 @@ public class YailDictionary extends LinkedHashMap<Object, Object> ...@@ -122,17 +122,8 @@ public class YailDictionary extends LinkedHashMap<Object, Object>
for (YailList currentYailList : pairs) { for (YailList currentYailList : pairs) {
Object currentKey = currentYailList.getObject(0); Object currentKey = currentYailList.getObject(0);
Object currentValue = currentYailList.getObject(1); Object currentValue = currentYailList.getObject(1);
if (currentValue instanceof YailList) {
if (isAlist((YailList) currentValue)) {
map.put(currentKey, alistToDict((YailList) currentValue));
} else {
map.put(currentKey, checkList((YailList) currentValue));
}
} else {
map.put(currentKey, currentValue); map.put(currentKey, currentValue);
} }
}
return new YailDictionary(map); return new YailDictionary(map);
} }
......
...@@ -372,15 +372,10 @@ public class YailDictionaryTest { ...@@ -372,15 +372,10 @@ public class YailDictionaryTest {
YailList.makeList(new Object[] { YailList.makeList(new Object[] {
YailList.makeList(new Object[] { "a", "b" }), 2, 3})}), YailList.makeList(new Object[] { "a", "b" }), 2, 3})}),
YailList.makeList(new Object[] { "dict", YailList.makeList(new Object[] { "dict",
YailList.makeList(new Object[] { YailDictionary.makeDictionary("a","b")}),
YailList.makeList(new Object[] { "a", "b" })})}),
YailList.makeList(new Object[] { "list-with-dict", YailList.makeList(new Object[] { "list-with-dict",
YailList.makeList(new Object[] { YailList.makeList(new Object[] {
YailList.makeList(new Object[] { YailDictionary.makeDictionary("a","b")
YailList.makeList(new Object[] {
"a", "b"
})
})
})}) })})
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment