java.util.concurrent.ConcurrentSkipListMap的isEmpty()方法是Java中的內置函數,它返回布爾值,如果該映射不包含鍵值映射,則返回boolean值,否則返回false。
用法:
public boolean isEmpty()
參數:該函數不接受任何參數。
返回值:如果此映射不包含鍵值映射,則該函數返回true,否則返回false。
以下示例程序旨在說明上述方法:
示例1:
// Java Program Demonstrate isEmpty()
// method of ConcurrentSkipListMap
import java.util.concurrent.*;
class GFG {
public static void main(String[] args)
{
// Initializing the map
ConcurrentSkipListMap<Integer, Integer>
mpp = new ConcurrentSkipListMap<Integer,
Integer>();
// Adding elements to this map
for (int i = 1; i <= 5; i++)
mpp.put(i, i);
// checking if map is empty
System.out.println(mpp.isEmpty());
}
}
輸出:
false
示例2:
// Java Program Demonstrate isEmpty()
// method of ConcurrentSkipListMap
import java.util.concurrent.*;
class GFG {
public static void main(String[] args)
{
// Initializing the map
ConcurrentSkipListMap<Integer, Integer>
mpp = new ConcurrentSkipListMap<Integer,
Integer>();
// checking if map is empty
System.out.println(mpp.isEmpty());
}
}
輸出:
true
參考: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListMap.html#isEmpty–
相關用法
- Java ConcurrentSkipListMap put()用法及代碼示例
- Java ConcurrentSkipListMap ceilingKey()用法及代碼示例
- Java ConcurrentSkipListMap clone()用法及代碼示例
- Java ConcurrentSkipListMap containsValue()用法及代碼示例
- Java ConcurrentSkipListMap containsKey()用法及代碼示例
- Java ConcurrentSkipListMap equals()用法及代碼示例
- Java ConcurrentSkipListMap size()用法及代碼示例
- Java ConcurrentSkipListMap remove()用法及代碼示例
- Java ConcurrentSkipListMap clear()用法及代碼示例
- Java Set isEmpty()用法及代碼示例
- Java Map isEmpty()用法及代碼示例
- Java AbstractCollection isEmpty()用法及代碼示例
- Java - AbstractMap isEmpty()用法及代碼示例
- Java Collection isEmpty()用法及代碼示例
- Java Properties isEmpty()用法及代碼示例
注:本文由純淨天空篩選整理自Twinkl Bajaj大神的英文原創作品 ConcurrentSkipListMap isEmpty() method in Java with Examples。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。