Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a sorted java collection which handles duplicates?

I need a collection that behaves something like C++ multimap, but I also need to be able to get elements by a range of keys.

like image 730
Steinbitglis Avatar asked Apr 17 '10 12:04

Steinbitglis


People also ask

Does sorted Set allow duplicates Java?

Remarks. The SortedSet<T> class does not accept duplicate elements. If item is already in the set, this method returns false and does not throw an exception.

Can sorted List have duplicate values?

A SortedList does not allow duplicate keys. Operations on a SortedList object tend to be slower than operations on a Hashtable object because of the sorting. Elements in this collection can be accessed using an integer index.

Which collection in Java allows duplicate values?

Duplicates : ArrayList allows duplicate values while HashSet doesn't allow duplicates values. Ordering : ArrayList maintains the order of the object in which they are inserted while HashSet is an unordered collection and doesn't maintain any order.

Which collection does not allow duplicates in Java?

A Set is a Collection that cannot contain duplicate elements.


1 Answers

You can look into Google Collections. It has multiple implementations for MultiMap.

like image 96
Matt Dearing Avatar answered Sep 19 '22 12:09

Matt Dearing