<commit_before>package ru.job4j;

import java.util.*;
/**
 * Chapter_003
 * Task 3.3.1
 * Sorting array users by name
 *
 * @author <NAME>
 * @version 1.0
 * @since 0.1
 */
public class SortUser {

    /**.
     * Sorting array by age
     * @param list
     * @return sorting list
     */
    public Set<User> sort (List<User> list) {
        Set<User> sortingList = new TreeSet<>();
        for(User user : list) {
            sortingList.add(user);
        }
        return sortingList;
    }

    /**.
     * Sorting array by hashCod
     * @param list
     * @return sorting array
     */
    public List<User> sortHash (List<User> list) {
        Collections.sort(list, new Comparator<User>() {
            public int compare(User o1, User o2) {
                return String.valueOf(o1.hashCode()).compareTo(String.valueOf(o2.hashCode()));
            }
        });
        return list;
    }

    public List<User> sortLength (List<User> list) {
        Collections.sort(list, new Comparator<User>() {
            public int compare(User o1, User o2) {
                return String.valueOf(o1.getName().length()).compareTo(String.valueOf(o2.getName().length()));
            }
        });
        return list;
    }

}<commit_msg>add file for chapter_003_3.3.2<commit_after>package ru.job4j;

import java.util.*;
/**
 * Chapter_003
 * Task 3.3.1
 * Sorting array users by name
 *
 * @author <NAME>
 * @version 1.0
 * @since 0.1
 */
public class SortUser {

    /**.
     * Sorting array by age
     * @param list
     * @return sorting list
     */
    public Set<User> sort (List<User> list) {
        Set<User> sortingList = new TreeSet<>();
        for(User user : list) {
            sortingList.add(user);
        }
        return sortingList;
    }

    /**.
     * Sorting array by hashCod
     * @param list
     * @return sorting array
     */
    public List<User> sortHash (List<User> list) {
        Collections.sort(list, (o1, o2) -> Integer.valueOf(o1.hashCode()).compareTo(Integer.valueOf(o2.hashCode())));
        return list;
    }

    public List<User> sortLength (List<User> list) {
        Collections.sort(list, (o1, o2) -> Integer.valueOf(o1.getName().length()).compareTo((o2.getName().length())));
        return list;
    }

}
{'fraction_non_alphanumeric': 0.14292035398230088, 'fraction_numerical': 0.019469026548672566, 'mean_word_length': 2.1359223300970873, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 25, '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': '3830903', 'n_tokens_mistral': 740, 'n_tokens_neox': 710, 'n_words': 169}