always internalize tag key Strings
This commit is contained in:
parent
97658f3ab1
commit
05d4dba5fc
@ -42,8 +42,7 @@ 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();
|
public static final String TAG_KEY_AMENITY = "amenity".intern();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The key of the elevation OpenStreetMap tag.
|
* The key of the elevation OpenStreetMap tag.
|
||||||
@ -101,12 +100,11 @@ public class Tag {
|
|||||||
public Tag(String key, String value, boolean intern) {
|
public Tag(String key, String value, boolean intern) {
|
||||||
this.key = key.intern();
|
this.key = key.intern();
|
||||||
|
|
||||||
if (intern) {
|
if (intern)
|
||||||
this.value = (value == null ? null : value.intern());
|
this.value = (value == null ? null : value.intern());
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
|
||||||
this.intern = intern;
|
this.intern = intern;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,11 +117,14 @@ public class Tag {
|
|||||||
}
|
}
|
||||||
Tag other = (Tag) obj;
|
Tag other = (Tag) obj;
|
||||||
|
|
||||||
|
if (this.key != other.key)
|
||||||
|
return false;
|
||||||
|
|
||||||
if (this.intern && other.intern) {
|
if (this.intern && other.intern) {
|
||||||
if ((this.key == other.key) && (this.value == other.value))
|
if (this.value == other.value)
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
if ((this.key.equals(other.key)) && (this.value.equals(other.value)))
|
if (this.value.equals(other.value))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user