Java List Flatten flatten(List> nested)

Here you can find the source of flatten(List> nested)

Description

flatten

License

Open Source License

Declaration

public static <T> ArrayList<T> flatten(List<List<T>> nested) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static <T> ArrayList<T> flatten(List<List<T>> nested) {
        ArrayList<T> flat = new ArrayList<>();
        for (List<T> subList : nested) {
            flat.addAll(subList);/*w  ww .jav a2  s  . c  om*/
        }
        return flat;
    }
}

Related

  1. flatten(List> list)
  2. flatten(List input)
  3. flatten(List list, List flat)
  4. flatten(List>... deeps)
  5. flatten(List l)
  6. flattenList(List> listOfLists)

  7. HOME | Copyright © www.java2s.com 2016