Optionals should be compared for value equality using .equals(), and not for reference equality using == and !=.
.equals()
==
!=
Suppress false positives by adding the suppression annotation @SuppressWarnings("OptionalEquality") to the enclosing element.
@SuppressWarnings("OptionalEquality")