I think your code is fine because based on the short name there is only one of each. But if for some reason you have multiple class with the same short name, the code will just return the first one. Not sure if that is by design.
- public List<Database> getImplementedDatabases()
- {
- List<Database> returnList = new ArrayList();
- for (SortedSet<Database> set : this.implementedDatabases.values()) {
- returnList.add(set.iterator().next());
- }
- return returnList;
- }
What if your set has more than one? Maybe,
resultList.addAll(set);