So, I have an ArrayList that contains another ArrayList, and I'm trying to see if the inner Arraylist contains a value that I'm looking for. If it does, I want to return the index in which that array exists.
List<List<String>> messages = parseMessages(extract.getPath()); String needle = "test"; messages.stream() // Stream<List<String>> .filter(message -> message.contains(needle)) .flatMap(List::stream) // Stream<String> .forEach(System.out::println); So I wrote this code after I captured an ArrayList within an ArrayList.
The array that I am trying to access is "Messages" which contains 2 other arraylist.
I want to use the contains method to check if the inner arraylist contains a value and return the index of that arrayList.
Thanks