-1

How can I create list that contain lists and each has multiple strings.

mylist = [['example01','example02','example03'],[example1','example2','example3'], [example4','example5','example6']]

So when I do "for each" still get list file?

Tried like without luck:

List<String> messages = Arrays.asList(("Hello","You"),("World","Power"));
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
TheName
  • 33
  • 6
  • 2
    Possible duplicate of [Working with a List of Lists in Java](https://stackoverflow.com/questions/1474954/working-with-a-list-of-lists-in-java) – Ashu Nov 18 '19 at 12:34

1 Answers1

1

Try

List<List<String>> messages = Arrays.asList(Arrays.asList("Hello","You"), Arrays.asList("World","Power"));
Ahmed HENTETI
  • 1,108
  • 8
  • 18