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

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -