ALL


  Use cases of Java enumeration

JDK 1.5 introduces a new type -- enumeration. In Java, it's just a small feature, but it can bring us much convenience.Here we summarize some use cases of Java enumeration.1. ConstantPrior to JDK 1.5, we can define constant as public static final..., now we can use enumeration to group all constants in one enum variable and it also provides some useful functions.public enum Color {    RED, GREEN, BLANK, YELLOW  }  2.In SwitchPrior to JDK 1.6, only int,char and enum are supported in switch statement, with enum, we can write more r...

3,615 0       JAVA ENUMERATION ENUM


  Difference between Enumeration and Iterator in java interview question and answer

This tutorial explains about what are the differences between Iterators and Enumeration and similarity of both interface which may be asked in a core java interview. Functionalities of both Iterator & Enumeration interfaces are similar that means both generates a series of all elements of the object which is to have its values iterated that can be traversed one at a time using next() method incase of Iterator and nextElement() method incase of Enumeration. The more powerful newer interface Iterator takes place of the old interface Enumeartion in the Java Collections Framew...

23,549 1       JAVA ITERATOR ENUMERATION