/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main
(String[] args
){ Set<Name> s = new HashSet<Name>();
s.add(n1);
System.
out.
print("HashCodes equal: "); System.
out.
println( n1.
hashCode() == n2.
hashCode()); System.
out.
print("Objects equal: "); System.
out.
println( n1.
equals(n2
) );
System.
out.
print("HashSet contains n1: "); System.
out.
println(s.
contains(n1
));
System.
out.
print("HashSet contains n2: "); System.
out.
println(s.
contains(n2
)); }
}
this.first = first;
this.last = last;
}
@Override
public boolean equals
(Object o
){ return n.first.equals(first) && n.last.equals(last);
}
public int hashCode(){
return 31*first.hashCode()+last.hashCode();
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCQoKICAgIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZ1tdIGFyZ3MpewogICAgICAgIFNldDxOYW1lPiBzID0gbmV3IEhhc2hTZXQ8TmFtZT4oKTsKICAgICAgICBOYW1lIG4xID0gbmV3IE5hbWUoIkRvbmFsZCIsICJEdWNrIik7CiAgICAgICAgTmFtZSBuMiA9IG5ldyBOYW1lKCJEb25hbGQiLCAiRHVjayIpOwogICAgICAgIHMuYWRkKG4xKTsKCiAgICAgICAgU3lzdGVtLm91dC5wcmludCgiSGFzaENvZGVzIGVxdWFsOiAiKTsKICAgICAgICBTeXN0ZW0ub3V0LnByaW50bG4oIG4xLmhhc2hDb2RlKCkgPT0gbjIuaGFzaENvZGUoKSk7CiAgICAgICAgU3lzdGVtLm91dC5w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