I have a Collection Object with structure like this:
[
{
"maBN": 8,
"address": "American",
"_type": "Person",
"name": "Anna Johnson",
"parent_of": [
{
"maBN": 10,
"address": "American",
"_type": "Person",
"name": "Abraham Napoleon",
"parent_of.type": "natural",
"_id": 63
},
{
"maBN": 11,
"address": "American",
"_type": "Person",
"name": "William Napoleon",
"parent_of.type": "natural",
"_id": 64
}
],
"_id": 61
}
]
I want to check if it null like this:
[
{}
]
This is my function to check it:
public Collection<Object> getFamilyTree(@RequestParam Long id, @RequestParam String gender) {
if (personService.getFamilyTree(id,gender).toArray().length!=0)
{
return personService.getFamilyTree(id, gender);
}
else{
return personService.getFamilyTree2Gen(id,gender);
}
}
With personService.getFamilyTree and personService.getFamilyTree2Gen return a Collection
What should I do? Thanks a lot and sorry for my bad English!