- What is Java?
- History of Java
- Hello Java Program
- Features of Java
- Basic Syntax
- Java Setup
- Data Types in Java
- Java Variables
- Operators in Java
- Java If-else Statement
- Switch Case Statement
- Java Loops
- Do-While Loop
- Java While Loop
- Continue Statement
- Break Statement in Java
- Constructors in Java
- Oops Concept in Java
- Features of OOPs
- Exeception handeling
- Aggregation (HAS-A relationship) in Java
- Method Overriding in Java
- Method Overloading
- Java Static Keyword
- Java This Keyword
- Java Final Keyword
- Static Binding and Dynamic Binding
- Abstract class in Java
- Access Modifiers in Java
- Difference between abstract class and interface
- Interface in Java
- Garbage Collection in Java
- Java Package
- Serialization and Deserialization in Java
- Java Inner Classes
- Java Applets
- Multithreading in Java
- Thread Priorities in Java
- Thread Creation
- Inter Thread Communication
- Wrapper Classes in Java
- Java Input Output
- Java AWT Introduction
- Java Layout Manager
- Java Layout Policy
- Java AWT Events
- Collection Framework
- Collection Framework List Interface
- Swing in Java
- Swing Utility Classes
- Swing Layout Managers
- Java JDBC
- Hibernate Framework Overview – Architecture and Basics
- Spring Environment Setup
- Spring Boot CRUD REST API Project using IntelliJ IDEA | Postman | MySQL
- Dockerizing Spring Boot Application | Spring Boot Docker Tutorial
- spring-boot-restapidocumentation with swagger
- Spring Boot HttpClient Overview
- Apache HttpClient POST HTTP Request Example
- Apache HttpClient PUT HTTP Request Example
- Apache HttpClient DELETE HTTP Request Example
- Apache HttpClient HTML Form POST Request Example
- Spring Boot JSP Exampl
- Deploying Spring Boot WAR file with JSP to Tomcat
- Spring Boot Annotations
- Spring Core Annotations
- Spring MVC Annotations with Examples
- Spring Scheduling Annotations
- Spring - Java-based Container Configuration
- Spring Java Based Configuration Example
- Hibernate 5 hello world
- Hibernate- One to One Unidirectional Mapping Annotation Example
- Hibernate - Batch Processing
- Hibernate - Interceptors
- Hibernate 5 - Create, Read, Update and Delete (CRUD) Operations Example
- Hibernate Transaction Management
- Hibernate One to Many Unidirectional Mapping Example
- Hibernate One to Many Bidirectional Mapping Example
- Hibernate Many to Many Annotation Mapping Example
- Hibernate Primary KeyJoin Column
- Hibernate First Level Cache with Example
- Hibernate XML Configuration Example with Maven + Eclipse + MySQL Database
- Hibernate Java Configuration Example
- JPA 2 with Hibernate 5 Bootstrapping Example
- JPA and Hibernate Cascade Types
- Hibernate/JPA - Primary Key Generation
- Hibernate 5 - Enum Type Mapping Example
- Hibernate Component Mapping
- Hibernate Object States – Transient,Persistent and Detached
- Hibernate 5 - Save an Entity Example
- Hibernate 5 - Persist an Entity Example
- Hibernate 5 - saveOrUpdate() Method Example
- Hibernate 5 - get(), load() and byId() Method Examples
- Hibernate 5 - merge() Example
- Hibernate 5 - Delete or Remove an Entity Example
- Hibernate 5 - load() Method Example
- Hibernate Session Interface Methods
- Hibernate Session.clear() Method Example
- Introduction Of Java strutes to Architecture
- Struts 2 - Architecture
- Struts 2 - Configuration Files
- Struts 2 - Actions
- Struts 2 - Interceptors
- Struts 2 - Results & Result Types
- Struts 2 - Value Stack/OGNL
- Struts 2 - File Uploading
- Struts 2 - Database Access
- Struts 2 - Validations Framework
- JavaFX Tutorial
- Introduction to JavaFX Pane
- JavaFX Popup
- JavaFX group
- JavaFX Controller
- JavaFX Gradient Color
- JavaFX Scene
- JavaFX Stage
- JavaFX Timeline
- JavaFX Timer
- JavaFX Image
- JavaFX Background
- JavaFX dialog
- JavaFX Font
- JavaFX GUI
- JavaFX FXML
The Java Collections framework standardizes how your programs handle a group of objects. Before Java2, Java provided ad hoc classes such as Vector, Stack, Dictionary, Hashtable and Properties to store and manipulate groups.
Although these classes were quite useful, they lacked a central unifying theme. The way we use Vector was different from how we use properties class; also, the previous ad hoc approach was not designed to be easily extensible or adaptable. Collections are an answer to these (and other) problems.
The Collection framework was designed, keeping into consideration the following objectives:
- The Framework has to be high-performance. The entire collections (dynamic arrays, linked lists, trees, and hash tables) are highly efficient.
- The Framework has to allow different types of collections to work in a similar manner and with a high interoperability degree.
- Extending and adapting to a collection had been easy.
To achieve the above goals, the collection framework design the following features:
- Entire Collection framework is designed around a set of standard interfaces. The several standard implementations of these interfaces are provided. We may also implement our collection.
- Another item created by the collections framework is the Iterator interface. An Iterator gives you a general-purpose, standardized way of accessing the element within a collection, one at a time.
- Thus, an Iterator provides a means of enumerating the contents of a collection. Because each group implement Iterator, the elements if any collection class can be accessed through the Iterator’s methods, this, with only small changes, the code that cycle through a set can also be used to cycle through a list, for example.
- In addition to collections, the framework defines several map interfaces and classes. Maps store key/value pairs. Although maps are not “collection” in the proper use of the term, they are fully integrated with collections.
- In the language of the collection framework, we can obtain a collection view of the map. Such an idea contains the elements form the map stored in a collection. Thus, we can process the contents of a plan as a collection, if you choose.
- The collection mechanism was retrofitted to some of the original classes defined by java.util package so that they too could be integrated into the new system.
- It is essential to understand that although collections altered many of the original utility classes’ architecture, it did not cause the deprecation of any. Groups simply provide a better way of doing several things.
The Collection Interfaces:
The collections framework defines several interfaces. The concrete classes provide different implementations of the standard interfaces. The interfaces that underpin collections are:
Enable you to work with a group of objects; it is at the top of the collections hierarchy.
Extends collection to handle sequences (lists of objects).
Extends collection to handle sets, which must contain unique elements.
Extends collection to handle sorted sets.
In addition to the collection interfaces, collections also use the Comparator, Iterator and RandomAccess interfaces. The comparator defines how two objects are compared; Iterator and ListIterator enumerate the items within a collection.
By implementing RandomAccess, a list indicates that it supports efficient, random access to its elements. To provide the greatest flexibility in their use, the collection interfaces allow some methods to be optional.
The optional methods enable you to modify the contents of a collection. Collections that support these methods are called elastic. Collections that do not allow their contents to be changed are called unmodifiable.
If an attempt is made to use one of these methods on an unmodifiable collection an UnsupportedOperationExceprin is thrown. All the built-in collections are modifiable.
The Iterator Interface
Iterator interface defines the following methods:
returns true if the iteration has more elements.
returns the next element in the iteration.
Removes from the underlying collection the last element returned by the iterator (may not allow doing so in some circumstances as in EJB’s). It is an optional operation, so it may throw UnsupportedOperationException if iterator does not support this operation.
Iterators differ from enumerations in two ways:
- Iterators allow the caller to remove elements from the underlying collection during the iteration with well-defined semantic.
- Method names have been improved.
The ListIterator Interface :
This is a subinterface of Iterator.
public interface ListIterator extends Iterator
It is an iterator for lists that allows the programmer to traverse4 the list in either direction, modify the list during iteration, and obtain the iteator’s current position in the list.
Method of Collection Interface:
Following are the methods declared in the Collection interface:
void add(Object obj)
Inserts the specified element into the list (optional operation).
Returns true if this list iterator has more elements when traversing the listin the forward direction.
Returns true if this list iterator has more elements when traversing the listin the reverse direction.
Return the next element in the list.
Returns the index if the element that would be returned by a subsequent call to next.
Return the previous element in the list.
Returns the index if the element that would be returned by a subsequent call to previous.
Remove from the list the last element that was returned by next or previous (optional operation).
void set(Object obj)
Replaces the last element returned by next or previous with the specified element (optional operation).
Apply now for Advanced Java Training Course