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

Popular posts from this blog

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -