- Timestamp:
- 2015-07-04T18:35:10+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java
r8565 r8566 469 469 /** 470 470 * The key/value list for this primitive. 471 *472 471 */ 473 472 protected String[] keys; … … 481 480 @Override 482 481 public Map<String, String> getKeys() { 483 Map<String, String> result = new HashMap<>(); 484 String[] keys = this.keys; 485 if (keys != null) { 486 for (int i = 0; i < keys.length; i += 2) { 487 result.put(keys[i], keys[i + 1]); 488 } 489 } 482 final String[] keys = this.keys; 483 if (keys == null || keys.length == 0) { 484 return Collections.emptyMap(); 485 } else if (keys.length == 2) { 486 return Collections.singletonMap(keys[0], keys[1]); 487 } 488 489 final Map<String, String> result = new HashMap<>(); 490 for (int i = 0; i < keys.length; i += 2) { 491 result.put(keys[i], keys[i + 1]); 492 } 493 490 494 return result; 491 495 }
Note:
See TracChangeset
for help on using the changeset viewer.