Click the below Image to Enlarge
All Tutorials Links
Design Patterns
Servlets
JDBC
JAVA
Spring & Spring Boot & WebService & Database & AWS
- All JavaEE Viedos Playlist
- All JavaEE Viedos
- All JAVA EE Links
- All Design Patterns Links
- Spring Tutorial
- Spring boot & JMS & Apache Kafka & Web Services
- Servlets Tutorial
- JDBC Tutorial
- JAVA Tutorial
- Java Collection Framework
- Apache Server Tutorial
- Apache Maven Tutorial
- JSON/XML/SQL/MongoDB Tutorials
- Computer Tutorial
- Kids Learning Tutorial
- Cooking Tutorial
- All Design Patterns Links
- Design Pattern - Playlists
- Design Pattern - Playlists - Part1
- Design Patterns - Introduction - Playlist
- J2EE Design Patterns - Playlist
- Creational Design patterns - Playlist
- Structural Design patterns - Playlist
- Behavioral Design patterns - Playlist
- Front Controller Design Pattern - Playlist
- Intercepting Filter Design Pattern - Playlist
- Business Delegate Design Pattern - Playlist
- Service Locator Design Pattern - Playlist
- Context Object Design Pattern - Playlist
- Data Access Object Design Pattern - Playlist
- Design Pattern - Playlists - Part2
- Object Pool Design Pattern - Playlist
- Singleton Design Pattern - Playlist
- Factory Design Pattern - Playlist
- Abstract Factory Design Pattern - Playlist
- Prototype Design pattern - Playlist
- Builder Design pattern - Playlist
- Iterator Design Pattern - Playlist
- Observer Design Pattern - Playlist
- Chain of Responsibility Design Pattern - Playlist
- Memento Design pattern - Playlist
- Design Pattern - Playlists - Part3
- Mediator Design pattern - Playlist
- Strategy Design pattern - Playlist
- Visitor Design pattern - Playlist
- State Design pattern - Playlist
- Command Design pattern - Playlist
- Interpreter Design pattern - Playlist
- Filter or Criteria Design Pattern - Playlist
- Composite Design Pattern - Playlist
- Proxy Design pattern - Playlist
- Flyweight Design pattern - Playlist
- Decorator Design pattern - Playlist
- Bridge Design pattern - Playlist
- Adapter Design pattern - Playlist
- Design Pattern - Playlists - Part4
- Base Design Pattern - Playlist
- Data Source Architectural Design Patterns - Playlist
- Object-Relational Metadata Mapping Design Patterns - Playlist
- Offline Concurrency Design Patterns - Playlist
- Domain Logic Design Patterns - Playlist
- Object-Relational Behavioral Design Patterns - Playlist
- Object-Relational Structural Design Patterns - Playlist
- Web Presentation Design Patterns - Playlist
- Distribution Design Patterns - Playlist
- Session State Design Patterns - Playlist
- Concurrency Design patterns - Playlist
- Design Pattern - Playlists - Part5
- Design Pattern - Playlists - Part1
- Design Patterns - Introduction
- Design Patterns
- Design patterns - catalog
- Enterprise Application Architecture Patterns
- Domain Logic Patterns
- Data Source Architectural Patterns
- Object Relational Behavioral Patterns
- Object-Relational Structural Patterns
- Object Relational Metadata Mapping Patterns
- Web Presentation Patterns
- Distribution Patterns
- Offline Concurrency Patterns
- Base Design Pattern
- Session State Design pattern
- Concurrency patterns
- J2EE patterns
- Creational Design patterns
- Structural design patterns
- Behavioral design patterns
- J2EE Design Patterns
- Creational Design patterns
- Creational Design patterns
- Object Pool Design Pattern
- Singleton Design Pattern
- Factory Design Pattern
- Abstract Factory Design Pattern
- Prototype Design Pattern
- Builder Design Pattern
- Builder Design Pattern - Introduction
- Builder Design pattern - Real Time Example [Meal Package]
- Builder Design pattern - Real Time Example [Animal Toys]
- Builder Design pattern - Real Time Example [Beverage]
- Builder Design Pattern - Class Diagram
- Builder Design Pattern - Sequence Diagram
- Builder Design Pattern - Implementation [Beverage]
- Builder Design Pattern - Implementation [Animal Toy]
- Builder Design Pattern - KeyPoints
- Behavioral design patterns
- Behavioral design patterns
- Iterator Design Pattern
- Observer Design Pattern
- Chain of Responsibility Design Pattern
- Chain of Responsibility Design Pattern - Introduction
- Chain of Responsibility Design Pattern - Real time Example
- Chain of Responsibility Design Pattern - Class and Sequence Diagram
- Chain of Responsibility Design Pattern - Implementation(One Receiver)
- Chain of Responsibility Design Pattern - Implementation(one or more Receiver)
- Chain of Responsibility Design Pattern - Key Points
- Momento Design pattern
- Template Design pattern or Template Method Design pattern
- Template Design pattern or Template Method Design pattern - Introduction
- Template Design pattern or Template Method Design pattern - Real Time Example [Coffee]
- Template Design pattern or Template Method Design pattern - Real Time Example [Car]
- Template Design pattern or Template Method Design pattern - Class Diagram
- Template Design pattern or Template Method Design pattern - Implementation [Building a House]
- Template Design pattern or Template Method Design pattern - Implementation [Coffee]
- Template Design pattern or Template Method Design pattern - KeyPoints
- Mediator Design pattern
- Mediator Design pattern - Introduction
- Mediator Design pattern - When to Use
- Mediator Design pattern - Real Time Example [Facebook]
- Mediator Design pattern - Real Time Example [ATC]
- Mediator Design pattern - Real Time Example [Chat Room]
- Mediator Design pattern - Class Diagram
- Mediator Design pattern - Implementation [Facebook]
- Mediator Design pattern - Implementation [Chat Room]
- Mediator Design pattern - KeyPoints
- Strategy Design pattern
- Strategy Design pattern - Introduction
- Strategy Design pattern - Real Time Example [Compress files]
- Strategy Design pattern - Real Time Example [Payment]
- Strategy Design pattern - Real Time Example [Travel]
- Strategy Design pattern - Real Time Example [Sorting]
- Strategy Design pattern - Real Time Example [Search]
- Strategy Design pattern - Class Diagram
- Strategy Design pattern - Sequence Diagram
- Strategy Design pattern - Implementation [Compress files]
- Strategy Design pattern - Implementation [Travel]
- Strategy Design pattern - Implementation [Payment]
- Strategy Design pattern - Implementation [Search]
- Strategy Design pattern - Implementation [Sort]
- Strategy Design pattern - KeyPoints
- Visitor Design pattern
- Visitor Design pattern - Introduction
- Visitor Design pattern - Real time Example [Kids]
- Visitor Design pattern - Real time Example [Products]
- Visitor Design pattern - Class Diagram
- Visitor Design pattern - Implementation [Kids]
- Visitor Design pattern - Implementation [Products]
- Visitor Design pattern - KeyPoints
- State Design pattern
- State Design pattern - Introduction
- State Design pattern - Real time example [ATM]
- State Design pattern - Real time example [TV Remote]
- State Design pattern - Real time example [Vending Machine]
- State Design pattern - Real time example [Project]
- State Design pattern - Class Diagram
- State Design pattern - Implementation [ATM]
- State Design pattern - Implementation [Vending Machine]
- State Design pattern - Implementation [Project]
- State Design pattern - Implementation [LED TV]
- State Design pattern - Keypoints
- Command Design pattern
- Command Design pattern - Introduction
- Command Design pattern - Real time example [Hotel]
- Command Design pattern - Real time example [Menu]
- Command Design pattern - Class Diagram
- Command Design pattern - Sequence Diagram
- Command Design pattern - Object Creation and flow
- Command Design pattern - Implementation [Menu]
- Command Design pattern - Key points
- Interpreter Design pattern
- Structural design patterns
- Structural design patterns
- Filter or Criteria Design Pattern
- Composite Design Pattern
- Proxy Design Pattern
- Proxy Design Pattern - Introduction
- Proxy Design pattern - Real Time Example[ATM]
- Proxy Design pattern - Real Time Example [Proxy Server]
- Proxy Design pattern - Class Diagram
- Proxy Design pattern - Sequence Diagram
- Proxy Design pattern - Implementation [Protection Proxy]
- Proxy Design pattern - Implementation [Remote Proxy]
- Proxy Design pattern - Implementation[Virtual Proxy]
- Proxy Design Pattern - Key Points
- Flyweight Design pattern
- Decorator Design pattern
- Decorator Design pattern - Introduction
- Decorator Design pattern - Real Time Example [Dosa]
- Decorator Design pattern - Real Time Example [Ice Cream]
- Decorator Design pattern - Real Time Example [Pizza]
- Decorator Design pattern - Real Time Example [Car]
- Decorator Design pattern - Class Diagram
- Decorator Design pattern - Sequence Diagram
- Decorator Design pattern - Implementation [Dosa]
- Decorator Design pattern - Implementation [Pizza]
- Decorator Design pattern - Implementation [Ice Cream]
- Decorator Design pattern - Implementation [Car]
- Decorator Design pattern - Implementation [Shape]
- Decorator Design pattern - Key Points
- Bridge Design pattern
- Bridge Design pattern - Introduction
- Bridge Design pattern - Real time example [Send Message]
- Bridge Design pattern - Real time example [Publish Message]
- Bridge Design pattern - Real time example [Shape]
- Bridge Design pattern - Real time example [TV]
- Bridge Design pattern - Class Diagram
- Bridge Design pattern - Implementation [Shape]
- Bridge Design pattern - Implementation [Send Message]
- Bridge Design pattern - Implementation [Publish Message]
- Bridge Design pattern - Implementation [LED TV]
- Bridge Design pattern - Keypoints
- Adapter Design Pattern
- Adapter Design pattern - Introduction
- Adapter Design Pattern - Real Time Exmaple(Translator)
- Adapter Design pattern - Real Time Example (Card Reader)
- Adapter Design pattern - Real Time Example (Mobile Charger)
- Adapter Design pattern - Real Time Example (Universal Adaptor)
- Adapter Design pattern - Real Time Example [JDBC Driver]
- Adapter Design pattern - Class diagram
- Adapter Design Pattern - Sequence diagram
- Adapter Design Pattern - Implementation [Language Translator]
- Adapter Pattern - Implementation [Object Adapter]
- Adapter Pattern - Implementation [Class Adapter]
- Adapter Design Pattern - Implementation [Mobile Charger]
- Adapter Design Pattern - Key Points
- Concurrency Design patterns
- Concurrency patterns
- Thread Pool Design Pattern
- Monitor or synchronization Design Pattern
- Lock Design Pattern
- Scheduler Design Pattern
- Read-write lock Design Pattern
- Messaging Design Pattern(MDP)
- Messaging Design Pattern(MDP) - Introduction
- Messaging Design Pattern(MDP) - Asynchronous messaging
- Messaging Design Pattern(MDP) - Two Way Messaging
- Messaging Design Pattern(MDP) - Implementation of Proxy
- Messaging Design Pattern(MDP)-Implementation of Adapter
- Messaging Design Pattern(MDP) - Implementation of Webservice
- Reactor Design Pattern
- Double-checked locking Design Pattern
- Offline Concurrency Patterns
- Session State Design pattern
- Distribution Patterns
- Base Design Pattern
- Base Design Pattern
- Gateway Design Pattern
- Layer Supertype Design Pattern
- Registry Design Pattern
- Money Design Pattern
- Plugin Design Pattern
- Special Case Design Pattern
- Separated Interface Design Pattern
- Service Stub Design Pattern
- Record Set Design Pattern
- Mapper Design Pattern
- Value Object Design Pattern
- Web Presentation Patterns
- Domain Logic Patterns
- Object Relational Structural Patterns
- Object-Relational Structural Patterns
- Identity Field Design Pattern
- Foreign Key Mapping Design Pattern
- Association Table Mapping Design Pattern
- Dependent Mapping Design Pattern
- Embedded Value Design Pattern
- Serialized LOB Design Pattern
- Single Table Inheritance Design Pattern
- Class Table Inheritance Design Pattern
- Concrete Table Inheritance Design Pattern
- Inheritance Mappers Design Pattern
- Object Relational Behavioral Patterns
- Object Relational MetadataMapping Patterns
- Data Source Architectural Patterns
- All Design Patterns Links
- Servlets Tutorial
- Servlets Tutorial - Playlists [Part 1]
- Servlets Tutorial - Playlist
- Tomcat - Playlist
- Servlets : WAR file - Playlist
- HTTP Methods and HTTP Status Codes - Playlist
- Client-Server Model - Playlist
- Servlet Application Creation using Eclipse - Playlist
- Servlets Basics - Playlist
- Servlets : Request and Response Headers - Playlist
- Servlets Form Data - Playlist
- Servlets : ServletConfig and ServletContext - Playlist
- Servlets : load-on-startup - Playlist
- Servlets : RequestDispatcher - Playlist
- Servlets : Send Redirect - Playlist
- Servlets Tutorial - Playlists [Part 2]
- Servlet Filter - Playlist
- Servlets : Filter Config - Playlist
- Servlets : HttpSession - Playlist
- Servlets : Cookies - Playlist
- Servlets : Attribute - Playlist
- Servlets : ServletRequestAttributeListener - Playlist
- Servlets : Listeners - Playlist
- Servlets : HttpSessionAttributeListener - Playlist
- Servlets : ServletContextAttributeListener - Playlist
- Servlets : ServletContextListener - Playlist
- Servlets : Upload File and Download File - Playlist
- Servlets : HttpSessionListener - Playlist
- Servlets : ServletRequestListener - Playlist
- Servlets : HttpSessionBindinglistener - Playlist
- Servlets : Session Tracking - Playlist
- Servlets : URL Rewriting - Playlist
- Servlets - Database Access - Playlist
- Servlets Basics - Part1
- Servlets Basics - Part2
- Servlets : Request and Response Headers
- Servlets Form Data
- ServletConfig and ServletContext
- Servlets : load-on-startup
- RequestDispatcher and Send Redirect
- RequestDispatcher Introduction
- Servlets : RequestDispatcher Example
- Servlets : Send Redirect Introduction
- Send Redirect Demo[Transfer control to the Servlet which is in the Same Webcontainer]
- Send Redirect Demo[Transfer control to different domain]
- Servlets : Send Redirect vs. Forward
- Page Redirection
- Filter Config
- Servlet Filter
- Servlet HttpSession
- Session Tracking
- Servlets Listeners
- Servlets Listeners
- ServletRequestAttributeListener Introduction
- ServletRequestAttributeListener Demo
- HttpSessionAttributeListener Introduction
- HttpSessionAttributeListener Demo
- ServletContextAttributeListener Introduction
- ServletContextAttributeListener Demo
- ServletContextListener Introduction
- ServletContextListener Demo
- HttpSessionListener Introduction
- HttpSessionListener Demo
- HttpSession Listener Demo [Count logged in Users]
- ServletRequestListener Introduction
- ServletRequestListener Demo
- HttpSessionBindinglistener Introduction
- HttpSessionBindinglistener Demo
- HttSessionActivationListener
- Servlets - Database Access
- MySQL Installation
- MySQL Workbench
- Oracle Database Server Installation
- Oracle Sql Developer Installation
- Oracle Sql Developer - Connect to the User
- JDBC|Servlets : BoneCP Connection Pooling - Oracle - Tomcat
- JDBC|Servlets : BoneCP Connection Pooling - Mysql- Tomcat
- JDBC|Servlets : BoneCP DataSource Oracle - Tomcat
- JDBC|Servlets : BoneCP DataSource Mysql - Tomcat
- JDBC|Servlets : Tomcat Connection Pooling - DBCP- Oracle
- JDBC|Servlets : Tomcat Connection Pooling - DBCP - Mysql
- JDBC|Servlets : Tomcat C3PO Connection Pooling - Mysql
- JDBC|Servlets : Tomcat C3PO Connection Pooling - Oracle
- Client-Server Model
- Eclipse
- Tomcat
- war file
- HTTP Methods and HTTP Status Codes
- Servlets Tutorial
- JDBC Tutorial
- JDBC Tutorial - Playlist [Part 1]
- JDBC Tutorial - Playlist
- Mysql Tutorial - Playlist
- JDBC : Steps to Connect to the Database and Demo - Playlist
- JDBC ResultSetMetadata - Playlist
- JDBC DatabaseMetadata - Playlist
- JDBC Statement - Playlist
- JDBC Connection - Playlist
- JDBC PreparedStatement - Playlist
- JDBC ResultSet - Playlist
- JDBC Create|Read|Update|Delete Records - Playlist
- JDBC Create|Drop Database - Playlist
- JDBC Create|Drop Table - Playlist
- JDBC Batch Processing - Playlist
- JDBC Scrollable ResultSet - Playlist
- JDBC Tutorial - Playlist [Part 2]
- JDBC DriverManager and JDBC Driver - Playlist
- Java Decompiler - Playlist
- JDBC Basics - Playlist
- JDBC Driver Types - Playlist
- JDBC Store and Retrieve Image - Playlist
- JDBC Store and Retrieve File - Playlist
- JDBC Transaction Management - Playlist
- JDBCRowSet - Playlist
- JDBC Mysql - Playlist
- JDBC Oracle - Playlist
- JDBC DataSource - Playlist
- JDBC DBCP DataSource - Playlist
- JDBC : Java Database Connection Pooling - Playlist
- Oracle Database & SqlDeveloper Tutorial - Playlist
- Bone CP Connection Pooling - Playlist
- DBCP Connection Pooling - Playlist
- C3PO Connection Pooling - Playlist
- JDBC Stored Procedure (Mysql) - Playlist
- JDBC Stored Procedure (Oracle) - Playlist
- Mysql & Oracle
- JDBC Basics
- JDBC Driver Types
- JDBC Driver Types
- Type 1 JDBC Driver : JDBC-ODBC Bridge Driver (Bridge Driver)
- Type 2 JDBC Driver: Native-API driver/Partly Java driver(Native Driver)
- Type 3 Driver : AllJava/Net-protocol driver or Network Protocol Driver(Middleware Driver)
- Type 4 Driver : All Java/Native-protocol driver or Thin Driver (Pure Java Driver)
- JDBC : Which Driver Should be used
- JDBC Statement & PreparedStatement
- JDBC ResultSet
- JDBC ResultSetMetadata
- JDBC DatabaseMetadata
- JDBC Create|Read|Update|Delete Records
- JDBC Batch Processing
- JDBC Transaction Management
- JDBC Store Image & File
- JDBCRowSet
- JDBC DataSource
- Java Database Connection Pooling
- JDBC : Java Database Connection Pooling [BoneCP vs DBPool vs C3PO]
- JDBC|Servlets : BoneCP Connection Pooling - Oracle - Tomcat
- JDBC|Servlets : BoneCP Connection Pooling - Mysql- Tomcat
- JDBC|Servlets : BoneCP DataSource Oracle - Tomcat
- JDBC|Servlets : BoneCP DataSource Mysql - Tomcat
- JDBC|Servlets : Tomcat Connection Pooling - DBCP- Oracle
- JDBC|Servlets : Tomcat Connection Pooling - DBCP - Mysql
- JDBC|Servlets : Tomcat C3PO Connection Pooling - Mysql
- JDBC|Servlets : Tomcat C3PO Connection Pooling - Oracle
- Object Pool Design Pattern - Introduction
- Object Pool Design Pattern - Implementation
- Connection Pooling [Example of Object Pool Design Pattern]
- Object Pool Design Pattern - KeyPoints
- JDBC Stored Procedure
- JDBC : CallableStatement Introduction.
- Mysql - Simple Stored Procedure
- Mysql - Stored Procedure with Input Parameter
- Mysql - Stored Procedure with multiple Input Parameters
- Mysql - Stored Procedure with Input and Output Parameters
- JDBC - CallableStatement with Input and Output Parameters(Mysql)
- JDBC - CallableStatement (Mysql)
- JDBC - CallableStatement with Input Parameter(Mysql)
- JDBC - CallableStatement Multiple In Out Parameters (Mysql)
- Oracle : Stored Procedure with Input and Output Parameters
- Oracle : Stored Procedure Cursor
- JDBC - CallableStatement In Out Parameters (Oracle)
- JDBC - CallableStatement Cursor(Oracle)
- JDBC - CallableStatement Cursor and multiple out param(Oracle)
- JDBC Tutorial
Friday, 31 October 2014
Java : Collection Framework : ArrayList Hierarchy
Click the below Image to Enlarge
Saturday, 25 October 2014
Java : Collection Framework : LinkedList (Remove Group of Objects)
LinkedListRemoveAllExample.java
import java.util.ArrayList; import java.util.LinkedList; import java.util.List; /* * Example of removeAll(Collection<?> c) method */ public class LinkedListRemoveAllExample { public static void main(String[] args) { LinkedList<String> linkedList = new LinkedList<String>(); linkedList.add("Ram"); linkedList.add("Dave"); linkedList.add("Peter"); linkedList.add("Julia"); linkedList.add("Akram"); System.out.println("linkedList : " + linkedList + "\n"); List<String> removeList = new ArrayList<String>(); removeList.add("Dave"); removeList.add("Peter"); System.out.println("RemoveList : " + removeList + "\n"); /* * Remove group of elements from the linkedList */ linkedList.removeAll(removeList); System.out .println("linkedList After removing elements which are present in the removeList : " + linkedList + "\n"); } }
linkedList : [Ram, Dave, Peter, Julia, Akram] RemoveList : [Dave, Peter] linkedList After removing elements which are present in the removeList : [Ram, Julia, Akram]
https://sites.google.com/site/javaee4321/java-collections/LinkedListDemoRemoveAll.zip?attredirects=0&d=1
See also:
Java : Collection Framework : LinkedList (Remove Object)
LinkedListRemoveExample.java
import java.util.LinkedList; /* * Example of remove(int index) and remove(Object o) methods */ public class LinkedListRemoveExample { public static void main(String[] args) { LinkedList<String> linkedList = new LinkedList<String>(); linkedList.add("Ram"); linkedList.add("Dave"); linkedList.add("Peter"); linkedList.add("Julia"); linkedList.add("Akram"); System.out.println("linkedList : " + linkedList + "\n"); /* * Remove element from the index position 1. */ linkedList.remove(1); System.out .println("linkedList After removing element from the index 1 : " + linkedList + "\n"); /* * Remove the String object Julia. */ linkedList.remove("Julia"); System.out .println("linkedList After removing String object \"Julia\" : " + linkedList); } }
linkedList : [Ram, Dave, Peter, Julia, Akram] linkedList After removing element from the index 1 : [Ram, Peter, Julia, Akram] linkedList After removing String object "Julia" : [Ram, Peter, Akram]
https://sites.google.com/site/javaee4321/java-collections/LinkedListDemoRemove.zip?attredirects=0&d=1
See also:
Java : Collection Framework : LinkedList (Add Group of Objects based on Index)
LinkedListAddAllIndexBasedExample.java
import java.util.HashSet; import java.util.LinkedList; import java.util.Set; /* * Example of addAll(Collection<? extends E> c) method */ public class LinkedListAddAllIndexBasedExample { public static void main( String[] args ) { LinkedList<Integer> linkedList = new LinkedList<Integer>(); linkedList.add(1); linkedList.add(2); linkedList.add(3); System.out.println("linkedList : " + linkedList); Set<Integer> set = new HashSet<Integer>(); set.add(4); set.add(5); System.out.println("set : " + set); /* * In Position 1 adding Set collection elements to the list collection */ linkedList.addAll(1,set); System.out.println("linkedList : " + linkedList); } }
linkedList : [1, 2, 3] set : [4, 5] linkedList : [1, 4, 5, 2, 3]
https://sites.google.com/site/javaee4321/java-collections/LinkedListDemoAddAllIndex.zip?attredirects=0&d=1
See also:
Friday, 24 October 2014
Java : Collection Framework : LinkedList (Add Object based on Index)
Click here to watch in Youtube : https://www.youtube.com/watch?v=kvtH4b6UO_A
LinkedListAddIndexBasedExample.java
import java.util.LinkedList; /* * Example of add(int index, E element) method */ public class LinkedListAddIndexBasedExample { public static void main( String[] args ) { LinkedList<Integer> linkedList = new LinkedList<Integer>(); linkedList.add(1); linkedList.add(2); linkedList.add(3); System.out.println("linkedList : " + linkedList); /* * In Position 2 adding 10 */ linkedList.add(2, 10); System.out.println("linkedList : " + linkedList); } }
linkedList : [1, 2, 3] linkedList : [1, 2, 10, 3]
https://sites.google.com/site/javaee4321/java-collections/LinkedListDemoAddIndex.zip?attredirects=0&d=1
See also:
Saturday, 18 October 2014
Java : Collection Framework : LinkedList (Constructors)
Click here to watch in Youtube : https://www.youtube.com/watch?v=5ztiuM7_b7A
Click the below Image to Enlarge
Java : Collection Framework : LinkedList |
Java : Collection Framework : LinkedList |
Friday, 17 October 2014
Java : Collection Framework : LinkedList (Add Group of Objects)
Click here to watch in Youtube : https://www.youtube.com/watch?v=l-Y57lQT6lM
LinkedListAddAllListExample.java
import java.util.LinkedList; /* * Example of addAll(Collection<? extends E> c) method */ public class LinkedListAddAllListExample { public static void main( String[] args ) { LinkedList<Integer> linkedList1 = new LinkedList<Integer>(); linkedList1.add(1); linkedList1.add(2); linkedList1.add(3); System.out.println("linkedList1 : " + linkedList1); LinkedList<Integer> linkedList2 = new LinkedList<Integer>(); linkedList2.add(4); linkedList2.add(5); System.out.println("linkedList2 : " + linkedList2); /* * Adding linkedList2 collection elements to the linkedList1 collection */ linkedList1.addAll(linkedList2); System.out.println("linkedList1 : " + linkedList1); } }
linkedList1 : [1, 2, 3] linkedList2 : [4, 5] linkedList1 : [1, 2, 3, 4, 5]
LinkedListAddAllSetExample.java
import java.util.HashSet; import java.util.LinkedList; import java.util.Set; /* * Example of addAll(Collection<? extends E> c) method */ public class LinkedListAddAllSetExample { public static void main( String[] args ) { LinkedList<Integer> linkedList = new LinkedList<Integer>(); linkedList.add(1); linkedList.add(2); linkedList.add(3); System.out.println("linkedList : " + linkedList); Set<Integer> set = new HashSet<Integer>(); set.add(4); set.add(5); System.out.println("Set : " + set); /* * Adding Set collection elements to the list collection */ linkedList.addAll(set); System.out.println("linkedList : " + linkedList); } }
linkedList : [1, 2, 3] Set : [4, 5] linkedList : [1, 2, 3, 4, 5]
https://sites.google.com/site/javaee4321/java-collections/LinkedListDemoAddAll.zip?attredirects=0&d=1
See also:
Java : Collection Framework : LinkedList (Add User Defined Object)
public class Student { private String name; private int age; public Student(String name, int age) { super(); this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } @Override public String toString() { return "Student [name=" + name + ", age=" + age + "]"; } }
import java.util.LinkedList; /* * Storing user-defined class objects. */ public class LinkedListExample { public static void main(String[] args) { LinkedList<Student> linkedList = new LinkedList<Student>(); Student john = new Student("John", 32); Student david = new Student("David", 42); Student peter = new Student("Peter", 52); linkedList.add(john); linkedList.add(david); linkedList.add(peter); /* * Using for each loop getting each student object from the linkedList */ for (Student student : linkedList) { System.out.println(student.toString()); } } }
Student [name=John, age=32] Student [name=David, age=42] Student [name=Peter, age=52]
https://sites.google.com/site/javaee4321/java-collections/LinkedListDemoUserDefined.zip?attredirects=0&d=1
See also:
Java : Collection Framework : LinkedList (Get each element using for-each loop)
Click here to watch in Youtube : https://www.youtube.com/watch?v=-UQw_YRP72c
LinkedListForEachExample.java
import java.util.LinkedList; public class LinkedListForEachExample { public static void main( String[] args ) { LinkedList<Integer> linkedList = new LinkedList<Integer>(); linkedList.add(100); linkedList.add(200); linkedList.add(300); linkedList.add(400); /* * Using for-each loop getting each element from the linkedList. */ for( Integer value : linkedList ) { System.out.println(value); } } }
100 200 300 400
https://sites.google.com/site/javaee4321/java-collections/LinkedListDemoForeach.zip?attredirects=0&d=1
See also:
Java : Collection Framework : LinkedList (Add Object)
LinkedListExample.java
import java.util.LinkedList; /* * Example of add(E e) method. */ public class LinkedListExample { public static void main( String[] args ) { LinkedList<Integer> linkedList = new LinkedList<Integer>(); /* * Appends the specified element to the end of this list. */ linkedList.add(100); linkedList.add(200); linkedList.add(300); linkedList.add(400); System.out.println("linkedList : "+linkedList); } }
linkedList : [100, 200, 300, 400]
https://sites.google.com/site/javaee4321/java-collections/LinkedListDemoAdd.zip?attredirects=0&d=1
See also:
Java : Collection Framework : ArrayList (Add or Replace element using ListIterator)
ArrayListExample.java
Output
import java.util.ArrayList; import java.util.ListIterator; /* * Example of add(E e) and set(E e) methods of ListIterator */ public class ArrayListExample { public static void main( String[] args ) { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("Ram"); arrayList.add("Dave"); arrayList.add("Peter"); arrayList.add("Julia"); arrayList.add("Akram"); System.out.println("arrayList : " + arrayList + "\n"); ListIterator<String> listIterator = arrayList.listIterator(); /* * Using ListIterator move the cursor in forward direction and add * element and replace element. */ while( listIterator.hasNext() ) { int indexPosition = listIterator.nextIndex(); if( indexPosition == 2 ) { /* * Inserts the specified element into the list */ listIterator.add("Virat"); } String name = listIterator.next(); if( name.equalsIgnoreCase("Ram") ) { /* * Replaces the last element returned by next() or previous() * with the specified element */ listIterator.set("Stephan"); } } System.out.println("List : " + arrayList + "\n"); } }
arrayList : [Ram, Dave, Peter, Julia, Akram] List : [Stephan, Dave, Virat, Peter, Julia, Akram]
https://sites.google.com/site/javaee4321/java-collections/ArrayListDemoListIteratorAddSet.zip?attredirects=0&d=1
See also:
Java : Collection Framework : ArrayList (ListIterator Index)
import java.util.ArrayList; import java.util.ListIterator; /* * Example of listIterator(int index) method */ public class ArrayListExample { public static void main(String[] args) { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("Ram"); arrayList.add("Dave"); arrayList.add("Peter"); arrayList.add("Julia"); arrayList.add("Akram"); System.out.println("arrayList : " + arrayList + "\n"); ListIterator<String> listIterator = arrayList.listIterator(2); /* * Using ListIterator move the cursor in forward direction and get each * element. */ System.out.println("Forward Direction -----" + "\n"); while (listIterator.hasNext()) { int nextIndex = listIterator.nextIndex(); String name = listIterator.next(); System.out.println(nextIndex + " : " + name); } } }
arrayList : [Ram, Dave, Peter, Julia, Akram] Forward Direction ----- 2 : Peter 3 : Julia 4 : Akram
https://sites.google.com/site/javaee4321/java-collections/ArrayListDemoListIteratorIndex.zip?attredirects=0&d=1
See also:
Java : Collection Framework : ArrayList (Remove elements using ListIterator)
import java.util.ArrayList; import java.util.ListIterator; /* * Example of remove() method of ListIterator */ public class ArrayListExample { public static void main(String[] args) { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("Ram"); arrayList.add("Dave"); arrayList.add("Peter"); arrayList.add("Julia"); arrayList.add("Akram"); System.out.println("arrayList : " + arrayList + "\n"); ListIterator<String> listIterator = arrayList.listIterator(); /* * Using ListIterator move the cursor in forward direction and remove * element one by one. */ while (listIterator.hasNext()) { listIterator.next(); /* * Removes from the list the last element that was returned by * next() or previous() methods */ listIterator.remove(); } System.out.println("arrayList : " + arrayList + "\n"); } }
arrayList : [Ram, Dave, Peter, Julia, Akram] arrayList : []
https://sites.google.com/site/javaee4321/java-collections/ArrayListDemoListIteratorRemove.zip?attredirects=0&d=1
See also:
Friday, 10 October 2014
Java : Collection Framework : ArrayList (ListIterator)
ArrayListExample.java
import java.util.ArrayList; import java.util.ListIterator; /* * Example of how to use ListIterator */ public class ArrayListExample { public static void main( String[] args ) { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("Ram"); arrayList.add("Dave"); arrayList.add("Peter"); arrayList.add("Julia"); arrayList.add("Akram"); System.out.println("arrayList : " + arrayList + "\n"); ListIterator<String> listIterator = arrayList.listIterator(); /* * Using ListIterator move the cursor in forward direction and get each * element. */ System.out.println("Forward Direction -----" + "\n"); while( listIterator.hasNext() ) { int nextIndex = listIterator.nextIndex(); String name = listIterator.next(); System.out.println(nextIndex + " : " + name); } System.out.println("\n" + "##############################" + "\n"); /* * Using ListIterator move the cursor in reverse direction and get each * element. */ System.out.println("Reverse Direction -----" + "\n"); while( listIterator.hasPrevious() ) { int previousIndex = listIterator.previousIndex(); String name = listIterator.previous(); System.out.println(previousIndex + " : " + name); } } }
arrayList : [Ram, Dave, Peter, Julia, Akram] Forward Direction ----- 0 : Ram 1 : Dave 2 : Peter 3 : Julia 4 : Akram ############################## Reverse Direction ----- 4 : Akram 3 : Julia 2 : Peter 1 : Dave 0 : Ram
https://sites.google.com/site/javaee4321/java-collections/ArrayListDemoListItrerator.zip?attredirects=0&d=1
See also:
Java : Collection Framework : ArrayList (Remove elements using Iterator)
ArrayListIteratorRemoveExample.java
import java.util.ArrayList; import java.util.Iterator; /* * Example of Iterator remove() method */ public class ArrayListIteratorRemoveExample { public static void main( String[] args ) { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("Ram"); arrayList.add("Dave"); arrayList.add("Peter"); arrayList.add("Julia"); arrayList.add("Akram"); System.out.println("arrayList : " + arrayList + "\n"); Iterator<String> iterator = arrayList.iterator(); while( iterator.hasNext() ) { iterator.next(); /* * Removes from the list the last element that was returned by * next() */ iterator.remove(); } System.out.println("arrayList : " + arrayList + "\n"); } }
arrayList : [Ram, Dave, Peter, Julia, Akram] arrayList : []
https://sites.google.com/site/javaee4321/java-collections/ArrayListDemoItrRemove.zip?attredirects=0&d=1
See also:
Java : Collection Framework : ArrayList (Convert to Array Object)
ArrayListToArrayExample.java
Output
import java.util.ArrayList; /* * Example of toArray(T[] a) method */ public class ArrayListToArrayExample { public static void main(String[] args) { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("Ram"); arrayList.add("Dave"); arrayList.add("Peter"); arrayList.add("Julia"); arrayList.add("Akram"); System.out.println("ArrayList : " + arrayList + "\n"); String[] strArray = new String[arrayList.size()]; /* * arrayList elements will be copied to StrArray */ arrayList.toArray(strArray); for (String name : strArray) { System.out.println(name); } } }
arrayList : [Ram, Dave, Peter, Julia, Akram]
Ram
Dave
Peter
Julia
Akram
import java.util.ArrayList; /* * Example of toArray() method */ public class ArrayListToObjArrayExample { public static void main( String[] args ) { ArrayList<String> arrayList = new ArrayList<String>(); arrayList.add("Ram"); arrayList.add("Dave"); arrayList.add("Peter"); arrayList.add("Julia"); arrayList.add("Akram"); System.out.println("arrayList : " + arrayList + "\n"); /* * Returns an array containing all of the elements in this list in * proper sequence (from first to last element). */ Object[] objArray = arrayList.toArray(); for( Object object : objArray ) { String name = (String) object; System.out.println(name); } } }
arrayList : [Ram, Dave, Peter, Julia, Akram]
Ram
Dave
Peter
Julia
Akram
https://sites.google.com/site/javaee4321/java-collections/ArrayListDemoToArray.zip?attredirects=0&d=1
See also:
Subscribe to:
Posts (Atom)
Tutorials
- Agile Tutorial (3)
- All Java EE Tutorial Links (4)
- All JAVA EE Tutorials (1)
- Amazon SQS Tutorial (17)
- Apache Maven (5)
- Apache Maven Tutorial (1)
- Apache Server (2)
- Apache Server Tutorial (1)
- AWS Tutorial (2)
- Computer Tricks (32)
- Cooking (1)
- Design Patterns (330)
- Design Patterns Tutorial (1)
- DevOps Tutorial (12)
- DNS Tutorials (8)
- Eclipse (5)
- Gradle (2)
- Gradle Tutorial (1)
- JAVA (2446)
- JAVA Basics (1522)
- Java Collection Framework (522)
- Java Collection Framework Tutorial (1)
- JAVA Tutorial (1)
- JDBC (117)
- JDBC Tutorial (1)
- JMS Tutorial (6)
- JSON (25)
- JSON Tutorial (1)
- Kids Learning (16)
- Kids Learning Tutorial (1)
- Linux (8)
- Mastering API Gateway: Complete Guide (5)
- MongoDB Tutorial (9)
- Mysql (11)
- Oracle (10)
- Scrum Tutorial (6)
- Service Discovery in Microservices (4)
- Servlets (150)
- Servlets Tutorial (1)
- Software Development Life Cycle (SDLC) (6)
- Spring (309)
- Spring Boot (173)
- Spring Boot Tutorial (2)
- Spring Tutorial (1)
- SQL (60)
- The Ultimate Guide to Forward & Reverse Proxies (5)
- Understanding Firewalls | Firewall Tutorial (8)
- VPN Basics: Understanding Virtual Private Networks (5)
- XML (9)