Question

I basically reviewed few open source libraries providing primitive collections types but can't find the exact thing I need.

Here are my requirements:

  1. Primitive double as a key
  2. Object as value, or (even better) parametrized by value type
  3. Sorted - after each insertion sorts automatically
  4. Sorting should be customizable - I might need my own sorting on doubles

Advise, please. Performance matters but let's not hollywar here on which favorite lib is faster.

PS: Please, do not ask why i need primitive double as a key.

Thank you for your advises!

Was it helpful?

Solution

Check out trove, colt or apache. From first glance it doesn't appear that they have built in auto-sorting (and chances are it's probably be pretty slim pickings to find one since auto-sorting and efficiency aren't usually closely related :-)) but that shouldn't be too hard for you to implement on top of their classes.

Here's a blog post showing the comparison between a couple primitive collection wrappers and java.util

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top