SyntaxFix
Write A Post
Hire A Developer
Questions
Supposing that you have a list and avoiding the isPresent() issue (related with optionals) you could use .iterator().hasNext() to check if not present.
isPresent()
.iterator().hasNext()