Changeset 2070 in josm for trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
- Timestamp:
- 2009-09-06T23:07:33+02:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/osm/TagCollection.java
r2017 r2070 6 6 import java.util.ArrayList; 7 7 import java.util.Collection; 8 import java.util.Collections; 8 9 import java.util.HashMap; 9 10 import java.util.HashSet; … … 571 572 throw new IllegalStateException(tr("tag collection can't be applied to a primitive because there are keys with multiple values")); 572 573 for (Tag tag: tags) { 573 primitive.put(tag.getKey(), tag.getValue()); 574 if (tag.getValue() == null || tag.getValue().equals("")) { 575 primitive.remove(tag.getKey()); 576 } else { 577 primitive.put(tag.getKey(), tag.getValue()); 578 } 574 579 } 575 580 } … … 682 687 return ret; 683 688 } 689 690 /** 691 * Replies the concatenation of all tag values (concatenated by a semicolon) 692 * 693 * @return the concatenation of all tag values 694 */ 695 public String getJoinedValues(String key) { 696 StringBuffer buffer = new StringBuffer(); 697 List<String> values = new ArrayList<String>(getValues(key)); 698 values.remove(""); 699 Collections.sort(values); 700 Iterator<String> iter = values.iterator(); 701 while (iter.hasNext()) { 702 buffer.append(iter.next()); 703 if (iter.hasNext()) { 704 buffer.append(";"); 705 } 706 } 707 return buffer.toString(); 708 } 684 709 }
Note:
See TracChangeset
for help on using the changeset viewer.