Is there an easy way to use lambda in java 8 to convert
from this object:
"coords" : [ {
"x" : -73.72573187081096,
"y" : 40.71033050649526
}, {
"x" : -73.724263,
"y" : 40.709908}
]
to this object:
"coordinates":[
[
[
-73.72573187081096,
40.71033050649526
],
[
-73.724263,
40.709908
]]
I try to use transform()
function but how can i transform from list to 2D array ?
here is my try, but i got an error:
coordinates =
Lists.newArrayList(
Lists.newArrayList(
Lists.newArrayList(
coords.stream()
.map( item -> Lists.newArrayList(ImmutableList.of(item.x, item.y))))));