#/help

14 messages · Page 1 of 1 (latest)

topaz dune
#

The last post closed for some reason, I don't know why...

Hello I'm trying to sort a LinkedHashMap with CollectionSort(), but it gets this error:

plucky kestrelBOT
#

This post has been reserved for your question.

Hey @topaz dune! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

mossy forum
#

You can't sort a LinkedHashStuff. It maintains a well-defined order, sure, but it doesn't offer to reorder.

topaz dune
plucky kestrelBOT
mossy forum
#

You could create another one, created in the order you want it

alpine panther
topaz dune
#

I'm sorry, I'm a beginer in this world

alpine panther
#

The signature of the map would be.
ArrayList<Map.Entry<Double Integer>>
However, I would use a TreeMap instead since that implementation of a Map is sorted by a comparator. You would have to switch your keys with your values however.
TreeMap<Integer,Double>
where the key is the power and the value is the coefficient.

#

You would create such a map like this:
TreeMap<Integer,Double> polynom = new TreeMap<>(Comparator.reverseOrder());

topaz dune
plucky kestrelBOT