Refactor flattening lists example (#1372)
This commit is contained in:
committed by
GitHub
parent
ac50687880
commit
99bebe806c
@@ -1,17 +0,0 @@
|
||||
package com.baeldung.list.flattennestedlist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FlattenNestedList {
|
||||
|
||||
public List<String> flattenListOfLists(List<List<String>> lol) {
|
||||
|
||||
// flatten the list
|
||||
List<String> ls = new ArrayList<>();
|
||||
lol.forEach((k) -> ls.addAll(k));
|
||||
|
||||
return ls;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user