clear(): This method is available in java.util.EnumMap class of Java.
Syntax:
void java.util.EnumMap.clear()
This method removes all mappings from this map.
Parameters: NA
Returns: NA
Exceptions: NA
Approach
Java
import java.util.EnumMap;public class EnumMapclear {public enum Colour {RED, GREEN, YELLOW, ORANGE};public static void main(String[] args) {EnumMap<Colour, String> enumMap =new EnumMap<Colour, String>(Colour.class);enumMap.clear();System.out.println(enumMap);}}
Output:
{}
No comments:
Post a Comment