equal
deleted
inserted
replaced
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 } |