Skip to content
Snippets Groups Projects
Select Git revision
  • d01f6fffd3d5f21bad5bef44effcd0f3aabee209
  • main default protected
  • master
3 results

Client.java

  • Forked from LABOUREL Arnaud / formula Template
    7 commits behind, 3 commits ahead of the upstream repository.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Client.java 1.09 KiB
    package agency;
    
    import java.util.Objects;
    
    public class Client {
      private final String firstName;
      private final String lastName;
      private final int yearOfBirth;
      public Client(String firstName, String lastName, int yearOfBirth) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.yearOfBirth = yearOfBirth;
      }
    
      public String getFirstName() {
        return firstName;
      }
    
      public String getLastName() {
        return lastName;
      }
    
      public int getYearOfBirth() {
        return yearOfBirth;
      }
    
      @Override
      public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
    
        Client client = (Client) o;
    
        if (yearOfBirth != client.yearOfBirth) return false;
        if (!Objects.equals(firstName, client.firstName)) return false;
        return Objects.equals(lastName, client.lastName);
      }
    
      @Override
      public int hashCode() {
        int result = firstName != null ? firstName.hashCode() : 0;
        result = 31 * result + (lastName != null ? lastName.hashCode() : 0);
        result = 31 * result + yearOfBirth;
        return result;
      }
    }