java - Adding duplicates in a custom Set -
a step ahead in tweaking api.
basically, set doesn't allow duplicate entries.
but when writing customized set how achieved allow adding duplicates?
a set mathematical definition is:
a well-defined collection of distinct objects
this reiterated in java definition:
a collection contains no duplicate elements. more formally, sets contain no pair of elements e1 , e2 such e1.equals(e2), , @ 1 null element. implied name, interface models mathematical set abstraction.
so in case, need use list in order have duplicates.
Comments
Post a Comment