
Hi Steve, yes, I agree that the replacements map is the safer solution. I'll post a 2nd version of the patch tomorrow. Gerd Steve Ratcliffe wrote
Hi Gerd
Coord is used as the key of a Map in lots of places.
If you change the lat or long then that also changes the hashCode and will cause a bug whenever the Coord is changed between put() and or get() on the Map.
OK, that seems to be a good argument against it, but on the other hand I think we always use IdentityHashMap because we want to find the same instance, not just an equal point, at least in StyledConverter (where I want to use the moveTo() method.
Elsewhere it is used in a regular hash map for example:
MultiPolygonRelation.java Map<Coord, JoinedWay> outOfBboxPoints = new HashMap<Coord, JoinedWay>(); POIGeneratorHook.java Map<Coord, Integer> labelCoords = new HashMap<Coord, Integer>(); SeaGenerator.java Map<Coord, Way> beginMap = new HashMap<Coord, Way>(); BoundaryRelation.java Map<Coord, JoinedWay> outOfBboxPoints = new HashMap<Coord, JoinedWay>(); PrecompSeaSaver.java Map<Coord, Long> coordIds = new HashMap<Coord, Long>();
..Steve _______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
-- View this message in context: http://gis.19327.n5.nabble.com/final-fields-in-Coord-tp5783182p5783208.html Sent from the Mkgmap Development mailing list archive at Nabble.com.