<commit_before>package ru.job4j.map;

import java.util.*;
/**
 * LoopFinder for task "2. Не перекрывать equals hashCode [#1005]".
 * @author <NAME> (<EMAIL>).
 * @version $Id$.
 * @since 14.07.18.
 */
public class User {
    private String name;
    private int children;
    private Calendar birthday;


    /**
     * constructor for User class.
     * @param name - String.
     * @param children - int.
     * @param birthday - Calendar.
     */
    public User(String name, int children, Calendar birthday) {
        this.name = name;
        this.children = children;
        this.birthday = birthday;
    }

    /**
     * @param args - String[].
     */
    public static void main(String[] args) {
        User user1 = new User("john", 1, new GregorianCalendar(1972, 8, 01));
        User user2 = new User("john", 1, new GregorianCalendar(1972, 8, 01));
        System.out.println(user1.hashCode());
        System.out.println(user2.hashCode());

        Map<User, Object> users = new HashMap<>();
        users.put(user1, new Object());
        users.put(user2, new Object());
        System.out.println(users);
    }

//    @Override
//    public boolean equals(Object o) {
//        if (this == o) return true;
//        if (!(o instanceof User)) return false;
//        User user = (User) o;
//        return children == user.children &&
//                Objects.equals(name, user.name) &&
//                Objects.equals(birthday, user.birthday);
////    }
////
    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + children + birthday.hashCode();
        return result;
    }
}<commit_msg>4. Переопределить только equals [#1004]<commit_after>package ru.job4j.map;

import java.util.*;
/**
 * LoopFinder for task "2. Не перекрывать equals hashCode [#1005]".
 * @author <NAME> (<EMAIL>).
 * @version $Id$.
 * @since 14.07.18.
 */
public class User {
    private String name;
    private int children;
    private Calendar birthday;


    /**
     * constructor for User class.
     * @param name - String.
     * @param children - int.
     * @param birthday - Calendar.
     */
    public User(String name, int children, Calendar birthday) {
        this.name = name;
        this.children = children;
        this.birthday = birthday;
    }

    /**
     * @param args - String[].
     */
    public static void main(String[] args) {
        User user1 = new User("john", 1, new GregorianCalendar(1972, 8, 01));
        User user2 = new User("john", 1, new GregorianCalendar(1972, 8, 01));
        System.out.println(user1.hashCode());
        System.out.println(user2.hashCode());

        Map<User, Object> users = new HashMap<>();
        users.put(user1, new Object());
        users.put(user2, new Object());
        System.out.println(users);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof User)) return false;
        User user = (User) o;
        return children == user.children &&
                Objects.equals(name, user.name) &&
                Objects.equals(birthday, user.birthday);
    }

//    @Override
//    public int hashCode() {
//        int result = name != null ? name.hashCode() : 0;
//        result = 31 * result + children + birthday.hashCode();
//        return result;
//    }
}
{'fraction_non_alphanumeric': 0.14624037892243932, 'fraction_numerical': 0.023386619301361752, 'mean_word_length': 2.1345083487940633, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3306663', 'n_tokens_mistral': 1080, 'n_tokens_neox': 991, 'n_words': 288}