altoslib: switch from keySet() to keys() in altos map tiles
authorKeith Packard <keithp@keithp.com>
Wed, 20 Apr 2016 03:18:46 +0000 (23:18 -0400)
committerKeith Packard <keithp@keithp.com>
Wed, 20 Apr 2016 03:21:30 +0000 (23:21 -0400)
Android appears to not have the keySet() API in the same way that
regular java does, so use the alternate older keys() api instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosMap.java

index 6c08f2d73ddcae1d0cc31caa89da8e93528cc424..c79e52294d20942321b8af7ec047cbdfcf92b32f 100644 (file)
@@ -308,7 +308,11 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
                        upper_left = floor(transform.screen_point(new AltosPointInt(0, 0)));
                        lower_right = floor(transform.screen_point(new AltosPointInt(width(), height())));
                }
-               for (AltosPointInt point : tiles.keySet()) {
+
+               Enumeration<AltosPointInt> keyEnumeration = tiles.keys();
+
+               while (keyEnumeration.hasMoreElements()) {
+                       AltosPointInt point = keyEnumeration.nextElement();
                        if (point.x < upper_left.x || lower_right.x < point.x ||
                            point.y < upper_left.y || lower_right.y < point.y) {
                                tiles.remove(point);
@@ -377,7 +381,10 @@ public class AltosMap implements AltosMapTileListener, AltosMapStoreListener {
 
        /* AltosMapTileListener methods */
        public synchronized void notify_tile(AltosMapTile tile, int status) {
-               for (AltosPointInt point : tiles.keySet()) {
+               Enumeration<AltosPointInt> keyEnumeration = tiles.keys();
+
+               while (keyEnumeration.hasMoreElements()) {
+                       AltosPointInt point = keyEnumeration.nextElement();
                        if (tile == tiles.get(point)) {
                                AltosPointInt   screen = transform.screen(point);
                                repaint(screen.x, screen.y, AltosMap.px_size, AltosMap.px_size);