Here you can find the source of flatten(List>... deeps)
@SafeVarargs public static <T> List<T> flatten(List<List<T>>... deeps)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { @SafeVarargs public static <T> List<T> flatten(List<List<T>>... deeps) { List<T> result = new LinkedList<>(); for (List<List<T>> deep : deeps) { for (List<T> list : deep) { result.addAll(list);/*w w w. ja v a 2 s .c om*/ } } return result; } }