Return a Boolean if the Optional Is Empty April 29, 2019 Beginning with JDK 11, we can return a boolean if the Optional is empty via Optional#isEmpty(): public boolean bookIsEmpty(long id) { Optional book = // code that fetches the book