How to make element unique in Java Collection?

China
April 24, 2011 8:30am CST
Java Collection can store many elements. Some Collection like Set must guarantee element unique. So, I want to know how to make it? In Java, which code can implement this function?
1 response
@jackycui (32)
• China
27 Apr 11
Methods - hasCode() and equals() can make element unique in Java Collection. http://www.javaol.net/2011/02/implementing-hashcode-and-equals/
• China
30 Apr 11
Hi jackycui, Thanks for your good answer.