java - How can we maintain unique object list without using set? -


suppose have 2 employee instances having common attributes id,name,address (all values same ).

i want unique objects list without implementing set.

please don’t explain logic primitive data type ,i want uniqueness object type.

simple: create "collection" class calls uses equals() method of "incoming" objects compare them against stored objects.

if method gives false - no duplicate, add collection. if true - not unique. no adding.

in other words - re-invent wheel , create resembles java set. of course, implicit drawbacks - such repeating implementation bugs fixed in java set implementations 15 20 years ago.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -