diff options
Diffstat (limited to 'main/src/cgeo/geocaching/cgCache.java')
| -rw-r--r-- | main/src/cgeo/geocaching/cgCache.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java index 30c2f3a..7f6e88c 100644 --- a/main/src/cgeo/geocaching/cgCache.java +++ b/main/src/cgeo/geocaching/cgCache.java @@ -198,10 +198,10 @@ public class cgCache implements ICache { myVote = other.getMyVote(); } if (attributes == null) { - attributes = other.getAttributes(); + attributes = other.attributes; } if (waypoints == null) { - waypoints = other.getWaypoints(); + waypoints = other.waypoints; } else { cgWaypoint.mergeWayPoints(waypoints, other.getWaypoints(), waypoints == null || waypoints.isEmpty()); @@ -555,7 +555,10 @@ public class cgCache implements ICache { @Override public List<String> getAttributes() { - return attributes; + if (attributes == null) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(attributes); } @Override @@ -1077,4 +1080,15 @@ public class cgCache implements ICache { matcher = coordPattern.matcher(note); } } + + public void addAttribute(final String attribute) { + if (attributes == null) { + attributes = new ArrayList<String>(); + } + attributes.add(attribute); + } + + public boolean hasAttributes() { + return attributes != null && attributes.size() > 0; + } } |
