diff -r 7993cfab8610 -r 4a6acc42c3a1 src/share/classes/com/sun/tools/javac/util/List.java --- a/src/share/classes/com/sun/tools/javac/util/List.java Fri Aug 30 17:36:47 2013 -0700 +++ b/src/share/classes/com/sun/tools/javac/util/List.java Mon Sep 02 22:38:36 2013 +0100 @@ -116,6 +116,19 @@ return buf.toList(); } + /** + * Create a new list from the first {@code n} elements of this list + */ + public List take(int n) { + ListBuffer buf = ListBuffer.lb(); + int count = 0; + for (A el : this) { + if (count++ == n) break; + buf.append(el); + } + return buf.toList(); + } + /** Construct a list consisting of given element. */ public static List of(A x1) {