I have two lists. The first one is an ID list of regions, the second one is a node list which has nested region objects.
Structure of my nodeList:
....{
"id": 6412,
"name": "303000201",
"description": "desc",
"organization": {
"id": 41065,
"name": "adad",
"address": null
},
"region": {
"id": 21,
"name": "Quba rayonu",
"code": "303"
},
"nodeType": {
"id": "WELL",
"name": "Quyu",
"description": null
},
"location": {
"id": 6412,
"latitude": 41.36735554,
"longitude": 48.5041245554
}} ......
And region list:
{
"regions": ["56", "44"]
}
I must filter my nodeList for region ID. I do it the old way but I want to do it with lambda expressions. How can I do it?
I googled, tried, but it doesn't work :/
result= nodeList.stream()
.filter(n -> regionIDList.equals(n.getRegion().getId().toString()))
.collect(Collectors.toList());
Thank you in advance.