always internalize Tag.key

This commit is contained in:
Hannes Janetzek 2013-05-06 04:40:03 +02:00
parent af58f7d915
commit 055cd92935

View File

@ -42,6 +42,9 @@ public class Tag {
*/ */
public static final String TAG_KEY_ELE = "ele".intern(); public static final String TAG_KEY_ELE = "ele".intern();
public static final String TAG_KEY_AMENITY= "amenity".intern();
/** /**
* The key of the elevation OpenStreetMap tag. * The key of the elevation OpenStreetMap tag.
*/ */
@ -93,15 +96,15 @@ public class Tag {
* @param value * @param value
* the value of the tag. * the value of the tag.
* @param intern * @param intern
* true when string should be intern()alized. * true when value string should be intern()alized.
*/ */
public Tag(String key, String value, boolean intern) { public Tag(String key, String value, boolean intern) {
this.key = key.intern();
if (intern) { if (intern) {
this.key = (key == null ? null : key.intern());
this.value = (value == null ? null : value.intern()); this.value = (value == null ? null : value.intern());
} }
else { else {
this.key = key;
this.value = value; this.value = value;
} }
this.intern = intern; this.intern = intern;