Skip to content

Instantly share code, notes, and snippets.

@sandeepnegi1996
Created September 29, 2024 07:28
Show Gist options
  • Save sandeepnegi1996/27dccad21cabfa842b35c87054aa1e48 to your computer and use it in GitHub Desktop.
Save sandeepnegi1996/27dccad21cabfa842b35c87054aa1e48 to your computer and use it in GitHub Desktop.
Code samples
```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