Skip to content

Commit

Permalink
Set commas correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpoole committed Nov 4, 2023
1 parent cbaf37d commit cf966d2
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/main/java/de/blau/android/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -4619,21 +4619,9 @@ public String descriptionForContextMenu(@NonNull OsmElement e, double lon, doubl
* @param e the OsmElement
*/
private <E extends OsmElement> void appendToTextList(@NonNull StringBuilder list, @NonNull List<E> elements, @NonNull E e) {
list.append(e.getDescription(this));
if (!lastMember(elements, e)) {
if (list.length() > 0) {
list.append(", ");
}
}

/**
* Check if this is the last member of a list
*
* @param <T> type of the List member
* @param l the list
* @param o the member we are checking
* @return true if it is the last item in the list
*/
private <T> boolean lastMember(@NonNull List<T> l, @NonNull T o) {
return l.indexOf(o) == (l.size() - 1);
list.append(e.getDescription(this));
}
}

0 comments on commit cf966d2

Please sign in to comment.