3 ms·
It could be worthwhile if this proposal were implemented: http://docs.google.com/Doc.aspx?id=k73_1ggr36h http://docs.google.com/Doc.aspx?id=k73_1ggr36h "Here
by jimbokun 17y ago
It could be worthwhile if this proposal were implemented:
http://docs.google.com/Doc.aspx?id=k73_1ggr36h http://docs.google.com/Doc.aspx?id=k73_1ggr36h
"Here is the same code rewritten using the proposed syntax:"
List<String> ls = ... ;
Collections.sort(ls,
Comparator<String>(String s1, String s2){ return s1.length() - s2.length(); });
By making anonymous inner class declaration more concise, you get many of the benefits of closures, without changing Java semantics.