From: Keith Packard Date: Wed, 20 Apr 2016 03:18:46 +0000 (-0400) Subject: altoslib: switch from keySet() to keys() in altos map tiles X-Git-Tag: 1.6.3~2^2~39 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=09acb6821ab490d69f679a195e70acb4a71ba342 altoslib: switch from keySet() to keys() in altos map tiles 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 --- diff --git a/altoslib/AltosMap.java b/altoslib/AltosMap.java index 6c08f2d7..c79e5229 100644 --- a/altoslib/AltosMap.java +++ b/altoslib/AltosMap.java @@ -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 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 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);