BAEL2489:Avoid check for null statements in Java (#6647)
* BAEL2489 - Avoid check for null statement in Java * BAEL2489 Avoid check for null statement in Java * BAEL2489 Avoid check for null statement in Java * BAEL2489 Avoid check for null statement in Java * BAEL2489 Avoid check for null statement in Java * BAEL2489 Avoid check for null statement in Java - Removing unused pom changes * BAEL2489 Avoid check for null statement in Java - Removing unused pom changes * Delete pom.xml Removing unused changes in core-java * BAEL2489 Avoid check for null statement in Java - Removing unused pom changes * BAEL2489 Avoid check for null statement in Java - adding ofnullable to Optional example
This commit is contained in:
parent
a7eb7bf8e0
commit
3d31d07b46
|
@ -8,11 +8,7 @@ public class UsingOptional {
|
|||
|
||||
String response = doSomething(processed);
|
||||
|
||||
if (response == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.of(response);
|
||||
return Optional.ofNullable(response);
|
||||
}
|
||||
|
||||
private String doSomething(boolean processed) {
|
||||
|
|
Loading…
Reference in New Issue