namedValueSet question


#1

Is it safe to assume that  NamedValueSet::getValueAt(int) is the quickest method for retrieving values from a NamedValueSet? I'm currently calling getWithDefault() at a pretty high frequency. I'm just wondering if I shouldn't swap them out for the getValueAt() methods. I thought I'd ask here first, as it will probably take a few hours to rework my code :)

 


#2

Getting the value at an index is undoubtedly fastest, but the main reason to choose a NamedValueSet is because you need to access items by their name. If you can write your algorithm using by-index access, then maybe there's a more appropriate data structure you could use instead?


#3

Good point. I'll have to have a think about this! Thanks.