list.add(0, new Object()); // 从下标 0 的位置 开始插入
list.set(1, new Object()); //调用set
插入 和 调用 为什么 要 new Object???
if (list.isEmpty()){
return; }
这句话的意思是不是 // 如果传入的数据为空 则反回出去
它这个 isEmpty()) 是什么作用
评论 (2)
- 受欢迎
- 新
- 旧
你必须先登录才能发表评论
Lisa
15 二月 2022, 12:42解决方法
isEmpty() just checks if the list contains any data. It is doing nothing else than
cause return returns no value I assume the methods return value is void. So isEmpty checks if there's data in the list and if not, it does not execute the code afterwards (and instead returns to the caller - if you're in the main method, then it leaves the program). +2
代码没写完啊~
16 二月 2022, 01:31
大佬 list.set(1, new Object()); 这里面 为啥要 new Object
0