import java.util.HashSet;
import java.util.Objects;

public class Test
{
    public static class Temp
    {
        public String name;
        public long number=System.nanoTime();

        public Temp(String s)
        {
            name=s;
        }

// @Override
// public int hashCode()
// {
// return Objects.hash(name);
// }


        @Override
        public boolean equals(Object obj)
        {
            if (this == obj) return true;
            if (obj == null) return false;
            if (getClass() != obj.getClass()) return false;
            Temp other = (Temp) obj;
            return Objects.equals(name, other.name);
        }

    }


    public static void main(String... argv) throws Exception
    {
        System.err.println(System.getProperty("java.runtime.name")+ " : " +System.getProperty("java.runtime.version"));

        HashSet<Temp> set1=new HashSet<>();
        HashSet<Temp> set2=new HashSet<>();

        set1.add(new Temp("asdf"));
        set2.add(new Temp("asdf"));

// javadoc : If so, it returns containsAll((Collection) o)
        System.err.println("set equals (expected true) : " + set1.equals(set2));
        System.err.println("set1 : "+set1);
        System.err.println("set2 : "+set2);
        System.err.println("set elements equals : " + set1.toArray()[0].equals(set2.toArray()[0]));

// javadoc : This implementation iterates over the specified collection, checking each element returned by the iterator in turn to see if it's contained in this collection
        System.err.println("set contains all (expected true) : " +set1.containsAll(set2));

// javaDoc : Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).
        System.err.println("set contains (expected true) : "+set1.contains(set2.toArray()[0]));

        System.err.println("object equals : " +Objects.equals(set2.toArray()[0],set1.toArray()[0]));
    }
}