I'm working on some LeetCode practice with binary search trees. I'm wondering if someone might explain the following method signature:
public List<List<Integer>> levelOrder(TreeNode root) {
I am confused by the use of Java Generics here -- what exactly List<List<Integer>> is saying in this case.
I understand Java Generics to be a way to "The <...> syntax allows you to write generic classes and methods that can handle multiple different types" according to https://programming.guide/java/less-than-greater-than-syntax.html
and I've seen it with with ArrayLists, but what does this specific definition of an integer list mean here?
Thanks
List<List<Integer>>can be parsedList<A>whereAisList<Integer>. So what you have is a list containing lists of integers.