[mkgmap-dev] final fields in Coord
From Steve Ratcliffe steve at parabola.me.uk on Mon Oct 28 21:30:27 GMT 2013
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
- Previous message: [mkgmap-dev] final fields in Coord
- Next message: [mkgmap-dev] final fields in Coord
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list