Created
September 29, 2024 07:28
-
-
Save sandeepnegi1996/27dccad21cabfa842b35c87054aa1e48 to your computer and use it in GitHub Desktop.
Code samples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```java | |
// optional examples | |
// in this case if masterGroup is null we will return the orElse part -> if it is not null we will return the actual object | |
// return masterGroupEntityModel.orElse(MasterGroupEntityModel.builder().id(5).build()); | |
// this call will check the getName in mastrGroup and if getName is not null it will return name if it is null it will return HSBC | |
return masterGroupEntityModel.map(MasterGroupEntityModel::getName) | |
.orElse("HSBC"); | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment