g**********y 发帖数: 14569 | 1 What's the most efficient data structure in Java to express:
key -> {key1:value1, key2:value2, ... keyN:valueN}
HashMap is one way. Since I need no operation other than
getter/setter, class is kind of heavy. Anything lighter? | g*****g 发帖数: 34805 | 2 Class is not heavy, just go ahead, a clean structure is way
better than minimal performance gain.
than
【在 g**********y 的大作中提到】 : What's the most efficient data structure in Java to express: : key -> {key1:value1, key2:value2, ... keyN:valueN} : HashMap is one way. Since I need no operation other than : getter/setter, class is kind of heavy. Anything lighter?
| A**o 发帖数: 1550 | 3 maybe op was doing memory tuning? ^_^
【在 g*****g 的大作中提到】 : Class is not heavy, just go ahead, a clean structure is way : better than minimal performance gain. : : than
| m******t 发帖数: 2416 | 4
You'd be suprised how much more memory efficient a Bean is than a hashmap.
8-)
Unless the keys in OP are dynamic, I'd define a bean class as bug suggested
and do it The Right Way(tm).
【在 A**o 的大作中提到】 : maybe op was doing memory tuning? ^_^
| g*****g 发帖数: 34805 | 5 Usually when we talk about performance, it's about data structure and
algorithm, the efficiency of single unit access, is far less important.
c << logN and we don't care about it until we have to.
suggested
【在 m******t 的大作中提到】 : : You'd be suprised how much more memory efficient a Bean is than a hashmap. : 8-) : Unless the keys in OP are dynamic, I'd define a bean class as bug suggested : and do it The Right Way(tm).
|
|