isEmpty(): This method is available in java.util.EnumSet class of Java.
Syntax:
boolean java.util.AbstractCollection.isEmpty()
This method returns true if this collection contains no elements.
Parameters: NA
Returns: true if this collection contains no elements.
Exceptions: NA
Approach
Java
import java.util.EnumSet;public class EnumSetisEmpty {public enum Colour {RED, GREEN, YELLOW, ORANGE};public static void main(String[] args) {EnumSet<Colour> enumSet = EnumSet.allOf(Colour.class);System.out.println(enumSet.isEmpty());}}
Output:
false
No comments:
Post a Comment