package ru.job4j.collections;

/**
 * Created by admin on 12.05.2017.
 */
public class User2 implements Comparable<User2> {
    private String name;
    private int age;

    public User2(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "User2{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public int compareTo(User2 o) {

        return this.age > o.age ? 1 : -1;
    }

    private int getAge() {
        return this.age;
    }

    public String getName() {
        return this.name;
    }

}
@@ -439,106 +439,8 @@
  %7D%0A%0A
-    @Override%0A    public int compareTo(User2 o) %7B%0A%0A        return this.age %3E o.age ? 1 : -1;%0A    %7D
 %0A%0A  
@@ -559,9 +559,311 @@
 %0A    %7D%0A%0A
+    @Override%0A    public int compareTo(User2 o) %7B%0A        return Integer.compare(this.age, o.age);%0A    %7D%0A%0A      @Override%0A    public boolean equals(Object o) %7B%0A%0A        User2 user2 = (User2) o;%0A%0A        return age %3E user2.age;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return age;%0A    %7D%0A
 %7D

task 10034