Java / Java8 streams
How to override equals method in Java8?
See the below code snippet.
@Override public boolean equals (Object obj) { return Optional.ofNullable(obj) .filter(that -> that instanceof Employee) .map(that -> (Employee) that) .filter(that -> this.fName.equals(that.fName)) .filter(that -> this.lName.equals(that.lName)) .isPresent(); } }
More Related questions...