package ru.job4j.collections.sort;

/**
 * This class describes simple user with name and age.
 *
 * @author Kucykh Vasily (mailto:basil135@mail.ru)
 * @version $Id$
 * @since 10.05.2017
 */
public class User implements Comparable<User> {

    /**
     * @param name is name of user.
     */
    private String name;
    /**
     * @param age is age of user.
     */
    private final int age;

    /**
     * constructor of class User.
     *
     * @param name is name of an user
     * @param age is age of an user
     */
    public User(final String name, final int age) {
        this.name = name;
        this.age = age;
    }

    /**
     * method return age of an user.
     *
     * @return age of an user
     */
    public int getAge() {
        return age;
    }

    /**
     * method compare this user with user o by age.
     *
     * @param o is user to compare with
     * @return number that show us this user older then user o or not
     */
    @Override
    public int compareTo(User o) {
        return this.age - o.getAge();
    }

}

@@ -763,32 +763,181 @@
 urn age;%0A    %7D%0A%0A
+    /**%0A     * method return name of user.%0A     *%0A     * @return name of user%0A     */%0A    public String getName() %7B%0A        return this.name;%0A    %7D%0A%0A
     /**%0A     * m
@@ -1199,10 +1199,810 @@
 %0A    %7D%0A%0A
+    /**%0A     * method equals compare this user with user o.%0A     *%0A     * @param o is user compare to%0A     * @return true if users are equals%0A     */%0A    @Override%0A    public boolean equals(Object o) %7B%0A%0A        if (this == o) %7B%0A            return true;%0A        %7D%0A%0A        if (o == null %7C%7C getClass() != o.getClass()) %7B%0A            return false;%0A        %7D%0A%0A        User user = (User) o;%0A%0A        if (age != user.age) %7B%0A            return false;%0A        %7D%0A%0A        return name != null ? name.equals(user.name) : user.name == null;%0A%0A    %7D%0A%0A    /**%0A     * method return hashcode of user.%0A     *%0A     * @return hashcode of user%0A     */%0A    @Override%0A    public int hashCode() %7B%0A%0A        int result = name != null ? name.hashCode() : 0;%0A%0A        result = 31 * result + age;%0A%0A        return result;%0A%0A    %7D%0A%0A
 %7D%0A

Refactor User.java added hashcode and equals