List of utility methods to do List Flatten
List | flatten(List extends Collection flatten List<T> flat = new ArrayList<>(); for (Collection<T> collection : list) { flat.addAll(collection); return flat; |
ArrayList> | flatten(List> input) flatten ArrayList<Object> result = new ArrayList<Object>(); for (Object o : input) { if (o instanceof List<?>) { result.addAll(flatten((List<?>) o)); } else { result.add(o); return result; |
void | flatten(List> list, List Helper method to flatten a potential list of lists into a list of objects. for (Object item : list) { if (item instanceof List<?>) { flatten((List<?>) item, flat); } else { flat.add(item); |
ArrayList | flatten(List
flatten ArrayList<T> flat = new ArrayList<>(); for (List<T> subList : nested) { flat.addAll(subList); return flat; |
List | flatten(List
flatten List<T> result = new LinkedList<>(); for (List<List<T>> deep : deeps) { for (List<T> list : deep) { result.addAll(list); return result; |
String | flatten(List flatten StringBuilder sb = new StringBuilder(); for (String s : l) { if (sb.length() > 0) sb.append(","); sb.append(s); return sb.toString(); |
List | flattenList(List
flatten List List<T> flatList = new ArrayList<T>(); listOfLists.forEach(flatList::addAll); return flatList; |