sortedmap Questions
7
Solved
Is there a Python design decision (PEP) that precludes a sorted container from being added to Python?
(OrderedDict is not a sorted container since it is ordered by insertion order.)
Knorr asked 10/5, 2011 at 16:24
4
Solved
I have a TreeMap<Date, Integer> and I want to fetch the nth item from that map. What I came up with now is this:
((Integer)myTreeMap.values().toArray()[index]).intValue();
but this feels q...
7
Solved
I have a
Map<Float, MyObject>
What is the best way to keep the map sorted according to the float?
Is SortedMap or TreeMap the best answer?
How do I use it?
I only create the map once and re...
2
Solved
Kotlins SortedMap is "a map that further provides a total ordering on its keys."
As a result, it should be indexable. However, this extension doesn't exist
`sortedMap.forEachIndexed()`
W...
Jota asked 10/6, 2021 at 9:20
2
Solved
EnumMap<K extends Enum<K>, V> in Java is clearly ordered by definition of the associated enum, as you can also see in the javadoc:
Enum maps are maintained in the natural order of the...
Marietta asked 15/1, 2020 at 10:45
1
Solved
If I have a NavigableMap already formed. What will be the time required for a floorEntry() operation to execute? will it be O(1) or O(logn)?
for example:
If I have a NavigableMap with n intervals...
3
Solved
I need a comparator for a TreeMap. Should I write this anonymously in the constructor for my TreeMap? How else could I write my comparator. Currently, Java does not like my code (can I do this anon...
Dunford asked 18/10, 2012 at 4:23
2
Solved
What is the time complexity of TreeMap.lastKey() part of the SortedMap interface?
The oracle docs mention this about TreeMaps:
This implementation provides guaranteed log(n) time cost for the ...
Hyponitrite asked 8/12, 2014 at 18:55
1
Solved
I am trying to figure out the computational complexity of equals() in both HashMap and TreeMap in Java. Now, you might say it should be same in both cases as both HashMap and TreeMap inherit the sa...
Bohannon asked 17/9, 2013 at 4:1
1
Solved
I have an val it:Iterator[(A,B)] and I want to create a SortedMap[A,B] with the elements I get out of the Iterator. The way I do it now is:
val map = SortedMap[A,B]() ++ it
It works fine but fee...
Eucalyptus asked 23/2, 2013 at 15:53
8
Solved
I am working with a TreeMap of Strings TreeMap<String, String>, and using it to implement a Dictionay of words.
I then have a collection of files, and would like to create a representation o...
Swats asked 14/12, 2011 at 9:58
5
Solved
Possible Duplicate:
Java: SortedMap, TreeMap, Comparable? How to use?
I am using the Java JungI graph package and Netbeans 7. I am getting the following error from Java:
Exception i...
Erenow asked 3/1, 2013 at 5:36
4
Solved
I encountered some unauthorized strangeness working with Scala's SortedMap[A,B]. If I declare the reference to SortedMap[A,B] "a" to be of type Map[A,B], then map operations on "a" will produce a n...
Catastrophism asked 27/9, 2012 at 20:8
1
Solved
I'm new to Scala.
I'm using SortedMap in my code, and I wanted to use mapValues to create a new map with some transformation on the values.
Instead of returning a new SortedMap, the mapValues func...
Grenada asked 26/9, 2012 at 21:0
2
Solved
How to create sorted map in scala (mutable/immutable)?
Sydneysydnor asked 19/4, 2010 at 8:48
1
Solved
My app uses a TreeMap to keep data sorted and have log(n) lookups & inserts. This works great in the general case while the app is running, but when the app first starts, I need to initialize t...
Quota asked 12/3, 2011 at 0:24
2
Solved
(I'm using Scala nightlies, and see the same behaviour in 2.8.0b1 RC4. I'm a Scala newcomer.)
I have two SortedMaps that I'd like to form the union of. Here's the code I'd like to use:
import sca...
Denys asked 21/12, 2009 at 3:39
5
Solved
I have a list of objects I need to sort according to properties of one of their fields. I've heard that SortedMap and Comparators are the best way to do this.
Do I implement Comparable with the c...
Electromagnetism asked 17/9, 2009 at 16:45
1
© 2022 - 2024 — McMap. All rights reserved.