@@ -0,0 +1,1973 @@
+package com.javarush.task.task21.task2107;%0A%0Aimport java.util.LinkedHashMap;%0Aimport java.util.Map;%0A%0A/* %0A%D0%93%D0%BB%D1%83%D0%B1%D0%BE%D0%BA%D0%BE%D0%B5 %D0%BA%D0%BB%D0%BE%D0%BD%D0%B8%D1%80%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5 %D0%BA%D0%B0%D1%80%D1%82%D1%8B%0A*/%0Apublic class Solution implements Cloneable %7B%0A%0A    public static void main(String%5B%5D args) %7B%0A        Solution solution = new Solution();%0A        solution.users.put(%22Hubert%22, new User(172, %22Hubert%22));%0A        solution.users.put(%22Zapp%22, new User(41, %22Zapp%22));%0A        Solution clone = null;%0A        try %7B%0A            clone = solution.clone();%0A            System.out.println(solution);%0A            System.out.println(clone);%0A%0A            System.out.println(solution.users);%0A            System.out.println(clone.users);%0A%0A        %7D catch (CloneNotSupportedException e) %7B%0A            e.printStackTrace(System.err);%0A        %7D%0A    %7D%0A%0A    protected Map%3CString, User%3E users = new LinkedHashMap();%0A%0A    public static class User implements Cloneable %7B%0A        int age;%0A        String name;%0A%0A        public User(int age, String name) %7B%0A            this.age = age;%0A            this.name = name;%0A        %7D%0A%0A        @Override%0A        protected User clone() throws CloneNotSupportedException %7B%0A            return new User(this.age, this.name);%0A        %7D%0A%0A        @Override%0A        public boolean equals(Object o) %7B%0A            if (this == o) return true;%0A            if (!(o instanceof User)) return false;%0A%0A            User user = (User) o;%0A%0A            if (age != user.age) return false;%0A            return name.equals(user.name);%0A        %7D%0A%0A        @Override%0A        public int hashCode() %7B%0A            int result = age;%0A            result = 31 * result + name.hashCode();%0A            return result;%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected Solution clone() throws CloneNotSupportedException %7B%0A        Solution solution = new Solution();%0A        for (Map.Entry%3CString, User%3E pair : this.users.entrySet()) %7B%0A            User user = pair.getValue().clone();%0A            solution.users.put(pair.getKey(), user);%0A        %7D%0A        return solution;%0A    %7D%0A%7D

Task --> 2107