I want used THashMap but how can I implement Trove specific APIs
(forEachEntry, forEachKey, forEachValue or transformValues) to potentially
gain higher performance for customerMap int GNUMAkeFile class.
public class GNUMakeFile {
/ @param args /
public static void main(String args) {
KeyObj key1 = new KeyObj(1);
KeyObj key2 = new KeyObj(2);
KeyObj key3 = new KeyObj(3);
ValObj val1 = new ValObj(11);
ValObj val2 = new ValObj(22);
ValObj val3 = new ValObj(33);
I want used THashMap but how can I implement Trove specific APIs
(forEachEntry, forEachKey, forEachValue or transformValues) to potentially
gain higher performance for customerMap int GNUMAkeFile class.
public class GNUMakeFile {
/
@param args
/
public static void main(String args) {
KeyObj key1 = new KeyObj(1);
KeyObj key2 = new KeyObj(2);
KeyObj key3 = new KeyObj(3);
ValObj val1 = new ValObj(11);
ValObj val2 = new ValObj(22);
ValObj val3 = new ValObj(33);
THashMap customerMap = new THashMap();
customerMap.put(key1, val1);
customerMap.put(key2, val2);
customerMap.put(key3, val3);
}
}
Maybe someone have link for simple examples with implementation Trove specific
APIs.
The advantage is speed and efficiency. When iterating, (at least) an iterator
object must be created. It also tends to be a little less efficient.
Here are example usages from the benchmark application...
For Each: http://trove4j.svn.sourceforge.net/viewvc/trove4j/main/trunk/test/g
nu/trove/benchmark/TroveHashMapForEach.java?revision=1&view=markup
Corresponding Iteration: http://trove4j.svn.sourceforge.net/viewvc/trove4j/ma
in/trunk/test/gnu/trove/benchmark/JavaHashMapIteration.java?revision=1&view=ma
rkup
Hope that helps...
Rob