0

How do I convert List<String[]> to List<List<String>>?

List<String[]> allData = csv.readAll();

allData needs to be coverted in List<List<String>>.

0

1 Answer 1

2

You can use stream and Arrays::asList which will convert String[] to a List<String>, like this:

List<List<String>> response = allData.stream()
        .map(Arrays::asList)
        .collect(Collectors.toList()); // or just .toList();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.