You may have noticed that we are using the awkward convention of keeping track of the keys we use for payments in a BackingMap and using sequential integers as keys. We've use this convention up to now because the ObjectMap API does not include several methods implemented on java.util.Map
. We can obtain a java.util.Map
representation of an ObjectMap by calling the getJavaMap()
method on an ObjectMap:
Map map = paymentsMap.getJavaMap();
This java.util.Map
does not implement all of the methods specified by the java.util.Map
interface. Most notably, this map does not have an implementation of the keySet(), entrySet()
, or values()
methods. In a typical Java application, a developer might get an entry set for a map and iterate over those entries with a for
for each loop. The body of the loop would contain any business logic required of the objects in the map. This is a great approach for maps that fit in the main memory, but it does not scale to the size of maps that can be...