Your javadoc looks fine to me. clear and understandable. Don't forget to add that the lists have to be created and have to be moodifiable, otherwise the method might complain with nasty exceptions. So much for the answer.
But I suggest you do not use out
parameters unless you're forced to do so (like if you have to implement 3rd party interfaces or you have to use JNDI).
The method is named getNodes
so most programmers expect, that the method returns an array or a collection of nodes. But in this case, the method populates two passed lists with nodes and holotypes.
So if your free to choose the method signature, I suggest you declare it like this:
public List<O> getNodes(List<O> cl) {
List<O> result = pickAllNodesFromList(cl);
return result;
}
public List<O> getHolotypes(List<O> cl) {
List<O> result = pickAllHolotypesFromList(cl);
return result;
}
or declare a special type for the class, like:
class CLTypes<O> {
List<O> nodes = new ArrayList<O>();
List<O> holotypes = new ArrayList<O>();
CLTypes(List<O> cl) {
nodes.addAll(pickAllNodes(cl));
holotypes.addAll(pickAllNodes(cl));
}
// getters for the nodes
// ...
// private methods to pick objects for source list
// ...
}
and implement the method like this:
public CLTypes<O> getNodes(List<O> cl) {
return new CLTypes<O>(cl);
}
If you need to return two lists (as I read from the comments above), another easy solution could be wrapping the two lists in a map:
public Map<String, List<O>> getNodes(List<O> cl) {
Map<String, List<O>> result = new HashMap<String, List<O>>();
result.put("nodes", pickAllNodes(cl));
result.put("holotypes", pickAllHolotypes(cl));
return result;
}