ConcurrentSkipListMap isEmpty() method in Java with Examples
The isEmpty() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which returns boolean value that is it returns true if this map contains no key-value mappings otherwise false.
Syntax:
public boolean isEmpty()
Parameter: The function does not accepts any parameters.
Return Value: The function returns true if this map contains no key-value mappings or else false.
Below programs illustrate the above method:
Program 1:
import java.util.concurrent.*;
class GFG {
public static void main(String[] args)
{
ConcurrentSkipListMap<Integer, Integer>
mpp = new ConcurrentSkipListMap<Integer,
Integer>();
for ( int i = 1 ; i <= 5 ; i++)
mpp.put(i, i);
System.out.println(mpp.isEmpty());
}
}
|
Program 2:
import java.util.concurrent.*;
class GFG {
public static void main(String[] args)
{
ConcurrentSkipListMap<Integer, Integer>
mpp = new ConcurrentSkipListMap<Integer,
Integer>();
System.out.println(mpp.isEmpty());
}
}
|
Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentSkipListMap.html#isEmpty–
Last Updated :
14 Feb, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...