.toArray(new String[visible.keySet().size()]);
/*
- * sort groups alphabetically, and ensure that null group is output last
+ * sort groups alphabetically, and ensure that features with a
+ * null or empty group are output after those in named groups
*/
List<String> sortedGroups = new ArrayList<String>(visibleFeatureGroups);
sortedGroups.remove(null);
+ sortedGroups.remove("");
Collections.sort(sortedGroups);
sortedGroups.add(null);
+ sortedGroups.add("");
boolean foundSome = false;
for (String group : sortedGroups)
{
- if (group != null)
+ boolean isNamedGroup = (group != null && !"".equals(group));
+ if (isNamedGroup)
{
out.append(newline);
out.append("STARTGROUP").append(TAB);
}
}
- if (group != null)
+ if (isNamedGroup)
{
out.append("ENDGROUP").append(TAB);
out.append(group);