Here you can find the source of flattenList(List> listOfLists)
public static <T> List<T> flattenList(List<List<T>> listOfLists)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import java.util.ArrayList; import java.util.List; public class Main { public static <T> List<T> flattenList(List<List<T>> listOfLists) { List<T> flatList = new ArrayList<T>(); listOfLists.forEach(flatList::addAll); return flatList; }// ww w . j av a 2 s. c o m }