Skip to content

Instantly share code, notes, and snippets.


yfklon/ Secret

Last active Mar 18, 2020
What would you like to do?
Immutable pojo class.
import java.util.Objects;
public final class SimplePojo {
private final String name;
private final String surname;
public SimplePojo(String name, String surname) { = name;
this.surname = surname;
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SimplePojo that = (SimplePojo) o;
return name.equals( &&
public int hashCode() {
return Objects.hash(name, surname);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.