langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java
changeset 42827 36468b5fa7f4
parent 32708 1a5b80de4f57
child 42828 cce89649f958
equal deleted inserted replaced
42826:563b42fc70ba 42827:36468b5fa7f4
   555     /**
   555     /**
   556      * Collect elements into a new list (using a @code{ListBuffer})
   556      * Collect elements into a new list (using a @code{ListBuffer})
   557      */
   557      */
   558     public static <Z> Collector<Z, ListBuffer<Z>, List<Z>> collector() {
   558     public static <Z> Collector<Z, ListBuffer<Z>, List<Z>> collector() {
   559         return Collector.of(ListBuffer::new,
   559         return Collector.of(ListBuffer::new,
   560                 (buf, el)->buf.add(el),
   560                 ListBuffer::add,
   561                 (buf1, buf2)-> { buf1.addAll(buf2); return buf1; },
   561                 (buf1, buf2)-> { buf1.addAll(buf2); return buf1; },
   562                 buf->buf.toList());
   562                 ListBuffer::toList);
   563     }
   563     }
   564 }
   564 }