Java EnumMap size() methodThe size() method of Java EnumMap class is used to get the size of the EnumMap. This method returns an integer whose value is the number of key-value mappings in this EnumMap. SyntaxParametersNA ReturnsThis method returns the size of this EnumMap. ExceptionNA Example 1Test it NowOutput: Map: {Java=1, CSS=2, Python=3, Android=4} Number of mappings: 4 Map: {Java=1, CSS=2, Python=3, Android=4, Javascript=5} Number of mappings: 5 Example 2Test it NowOutput: Map: {Monday=1, Tuesday=2, Wednesday=3} Number of mappings: 3 Map: {Monday=1, Tuesday=2, Wednesday=3, Thursday=4} Number of mappings: 4
Next TopicJava EnumMap
|