Please be patience with me if this question is too easy for you. I am new to Java generics, and encounter a coding example that I'm confused of. It wants to return all possible subsets when a set of distinct integers is given.
My questions:
Why does the code below use
List<List<Integer>>? Can you useList<Integer>instead?What's the technical term for a structure like
List<List<Integer>>? I'd like to read more online.
Thank you so much for your help!
public class Example { public List<List<Integer>> subsets(int[] nums) { } }