Is there any way to create Set data structure(Unique Collections) like java in javascript?
I have written a JavaScript implementation of a hash set that is similar to Java's HashSet. It allows any object (not just strings) to be used as a set member. It's based on the keys of a hash table.
http://code.google.com/p/jshashtable/downloads/list
Documentation will follow shortly, I promise. For now, the source should give you the API pretty clearly, and here's an example:
var s = new HashSet();
var o1 = {name: "One"}, o2 = {name: "Two"};
s.add(o1);
s.add(o2);
s.add(o2);
s.values(); // Array containing o1 and a single reference to o2