Refactor code to use ListValue.wrap(Stream)

Simplifies code (improving readability) and unifies `Stream<Value>` to `ListValue` handling
This commit is contained in:
altrisi authored and GitHub committed 2023-01-19 01:40:29 +01:00
1 parent dd1dc3756a
commit 17249c3c77
15 files changed
+66 -85

No files matched your search

@@ -17,7 +17,6 @@ import carpet.script.value.NumericValue;
import carpet.script.value.StringValue;
import carpet.script.value.Value;
import com.google.gson.JsonParseException;
import com.google.gson.JsonParser;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -186,7 +185,7 @@ public class DataStructures {
if (v instanceof MapValue)
return ListValue.wrap(((MapValue) v).getMap().entrySet().stream().map(
(p) -> ListValue.of(p.getKey(), p.getValue())
).collect(Collectors.toList()));
));
return Value.NULL;
});