Closed ghost closed 8 months ago
If I am following your ask, you want an unsorted key/value data structure. If that's the case, look at the Collection.Hash
class it's an implementation of a hash table.
If I am following your ask, you want an unsorted key/value data structure. If that's the case, look at the
Collection.Hash
class it's an implementation of a hash table.
Collection.Hash
sorts the elements. I use this code to iterate over it and print the elements:
E := Collection.Hash->New()<FloatRef, FloatRef>;
...
kvp := E->GetKeyValues()<Pair<FloatRef, FloatRef>>;
each(it := kvp) {
it->GetFirst()->Print();
" : "->Print();
it->GetSecond()->PrintLine();
}
I'm sure with you the elements are reordered.
The terms ordered and unordered drive me nuts. So I use what is familiar to us laymen: sorted and unsorted. I don't know if it's accurate, though. I posted many questions about the order of each data structure in
Collection
. It turned out that I'm still not really getting it! This time, I use only layman's terms and don't use the C++ STL as the reference. I admit, I don't understand C++ STL either.What I want is an unsorted map. I don't want the elements to be sorted. Btw, is it correct to call the key-value pair an element of the map? I don't know!
Perhaps because I described it unclearly and the inclusion of the C++ STL containers (which I don't really understand) in the comparison made it even more vague, you dismissed my previous feature request. This time, please consider.
Previous feature request: https://github.com/objeck/objeck-lang/issues/451