package com.web.liao.collection.equals; import java.util.Objects; public class PersonEquals { String firstName; String lastName; int age; public PersonEquals(String firstName, String lastName, int age){ this.firstName = firstName; this.lastName = lastName; this.age = age; } @Override public boolean equals(Object o) { if (this == o) return true; if (o instanceof PersonEquals){ PersonEquals pe = (PersonEquals) o; return Objects.equals(this.firstName, pe.firstName) && Objects.equals(this.lastName, pe.lastName) && this.age == pe.age; } return false; } }
Sign in to make a reply
皮塔莫拉克