static S longestString(Collection l) { S longest = null; int n = -1; if (l != null) for (S s : l) { int len = l(s); if (len > n) { n = len; longest = s; } } ret longest; }