关于java方法名的定义规则
ringa_lee
ringa_lee 2017-04-18 10:32:10
0
2
497

新人选手,初学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>>>,这又是什么意思呢?

新手码渣,往前辈们指点迷津!

ringa_lee
ringa_lee

ringa_lee

reply all(2)
迷茫

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...

PHPzhong

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template