ebean: Add API findOne() and findOneOrEmpty() which returns Optional
Expected behavior
Returning Java 8 Optional<? extends Model> when using the method findUnique to allow usage of fallback like orElse or orElseGet and avoiding the direct usage of if (x != null)
More information about Optional at Official Java 8 documentation.
Actual behavior
The method findUnique return an instance of the requested model or null.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 16 (15 by maintainers)
Commits related to this issue
- #996 Add findOne() and findOneOrEmpty() — committed to ebean-orm/ebean by rbygrave 7 years ago
- #996 Add findOne() and findOneOrEmpty() — committed to ebean-orm/ebean by rbygrave 7 years ago
- #996 Add findOne() and findOneOrEmpty() - SqlQuery — committed to ebean-orm/ebean by rbygrave 7 years ago
How about: