This Java code demonstrates the noneOf() method of the EnumSet class, which creates an empty EnumSet of the specified enum type.
import java.util.*; public class NoneOf_Method { public static void main(String[] args) { EnumSet < WEEKDAY > enum_set; //Adding elements to EnumSet. enum_set = EnumSet.allOf(WEEKDAY.class); System.out.println("EnumSet : " + enum_set); EnumSet < WEEKDAY > empty_set = EnumSet.noneOf(WEEKDAY.class); System.out.println("Empty EnumSet : " + empty_set); } } enum WEEKDAY { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };
EnumSet : [Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday] Empty EnumSet : []
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions