I was working on my project, then I need the reach an element in the Json Data Look like:
[
{
"name": "Meltem",
"items": [
{
"name": "Yilmaz",
"histories": [
{
"date": 1615370705561,
"school": "BAU"
}
]
}
]
}
]
So I can reach the element of name with:
var myData = data().
stream().
filter(x -> x.getName().equals("Meltem"))
.collect(Collectors.toList())
.get(0);
So, how to reach the school with using stream() in java 8?
Also, the getName()
where I called;
@Getter
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"name",
"items",
})
public class Package {
@JsonProperty("name")
private String name;
@JsonProperty("items")
private List<Item> items;
}