问题描述
对于初学者来说, // Get the user id (from the user object I guess)
const userId = user.uid;
// or maybe through const userId = fireApp.auth().currentUser.uid;
const proUserDocRef = db.collection('ProUser').doc(userId);
proUserDocRef.get().then((doc) => {
if (doc.exists && doc.data().status === true)) {
router.push("dashboard/products");
} else {
router.push("selfonboarding");
}
})
是有序集合,允许插入 null 元素。另一方面, int [][] A = new int[5][5];
int [][] B = new int[5][5];
for (int row = 0; row < A.length; row++) {
System.out.println();
for (int col = 0; col < A.length; coL++) {
B[row][col] = (row+1)*(col+1);
System.out.print("\t");
System.out.printf("%2d",B[row][col]);
}
}
是LIFO或FIFO集合,通常不允许 null 元素。 List
同时实现Queue
和LinkedList
,因此只有List
实现允许 null 作为元素。
假设Queue
中不允许 null 的原因是 poll()或 peek()之类的方法可以将 null 返回为:
- 没有更多元素
- 以null作为元素
* 这是对stackoverflow的常见回答,用于回答“为什么不允许在队列中使用null”的问题。
知道问题 null 会导致我们进入Queue
,任何程序员都可以做出以下逻辑:
Queue
使用我刚刚提供的逻辑,我们可以很容易地看出,如果我们得到 null 作为返回值,它将100%是元素的值,而不是 null 作为空队列。因此,我不得不再次问,Queue
中不允许 null 的真正原因是什么?我还想念其他东西吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)