新人选手,初学java,图里是这么教的方法命名规则:
但是leetcode里的这些方法,都是这样的
public class Solution {
public List<List<Integer>> levelOrder(TreeNode root) {
……
}
这个levelOrder前面这个 List<List<Integer>>属于什么?
还有就是 List<List<Integer>>是什么意思?为什么外面又套了一个list?我看还有三个list套在一起的, List<List<List<Integer>>>,这又是什么意思呢?
新手码渣,往前辈们指点迷津!
迷茫2017-04-18 10:34:10
List<List<Integer>>
is a type, and this form of type belongs to generic
Give you some references:
http://www.cnblogs.com/panjun...
http://www.infoq.com/cn/artic...
http://www.cnblogs.com/lwbqqy...
PHPz2017-04-18 10:34:10
List is a generic class and a container that stores objects of a specified type. List<Integer> is a linear list that can store Integer objects. List<List<Integer>> is a linear list, and each element is the above List<Integer> object.