Collection Framework in Java

Collection Framework in Java,The Java collections framework (JCF) is a set of classes and interfaces that implement commonly reusable collection data structures.

Collections Enhanced new for loop

This is the second tutorial on the enhanced for loop on collections. Earlier one is with arrays – Arrays Enhanced for loop (foreach). Collections Enhanced new for loop Observe the following program. import java.util.ArrayList; public class ForEachCollections { public static void main(String args[]) { // enhanced for loop with generics Integer array list ArrayList al1 …

Collections Enhanced new for loop Read More »

Enumeration Interface Example

Enumeration Interface Example: Enumeration interface is from java.util package. It was introduced with JDK 1.0. It is used by many data structures especially with legacy classes. The DS of JDK 1.0 are known as legacy classes. They are Stack, Vector, Hashtable and Properties. Enumeration Interface Example import java.util.*; public class EnumerationDemo { public static void …

Enumeration Interface Example Read More »

Iterator vs ListIterator

You have seen the iteration of elements in the following examples earlier. 1. Using Enumeration interface. 2. Using Iterator interface. 3. Using ListIterator interface. Also you have seen the analogy of Enumeration vs Iterator. Differences between Enumeration, Iterator and ListIterator are very confusing for a Beginner. Understandability increases when placed at a single place. Towards …

Iterator vs ListIterator Read More »

Java Choice Replacement Radio Buttons

Choice, another GUI component from the toolkit of classes of java.awt. Choice presents a pull-down menu. Choice is a replacement to radio buttons. Choice is chosen when radio buttons are many to display. Choice is popularly known as Combo box in other GUI environments. Choice, like radio buttons, allows selecting only one option among many. …

Java Choice Replacement Radio Buttons Read More »