Collection Basics
What is Collection
Why Collection ?
Collection API
Collection Hierarchy
List
What is List
What is ArrayList
What is LinkedList
What is Vector
method of vector class in java
What is Stack
List Advance
ArrayList user defined object
ArrayList internal implementation
LinkedList internal implementation
ArrayList VS LinkedList
ArrayList VS Vector
Set
What is HashSet
What is LinkedHashSet
What is TreeSet
Set Advance
When to Use HashSet
HashSet internal Working
When to use LinkedHashSet
TreeSet internal Working
Set add method
Iterate Collection
Iterate Collection
Advance for loop
What is Iterator
Advantage of Iterator
What is ListIterator
Iterator VS ListLterator
What is Enumeration
Enumeration VS Iterator
Map
What is HashMap
What is LinkedHashMap
What is TreeMap
What is Hashtable
What is WeakHashMap
What is IdentityHashMap
What is Properties file
Map Advance
What is Load-Factor
how to load properties file in java
how to iterate map in java
how to retrieve element of map using keySet
difference between hashmap and hashtable
Map Interview
Internal implementation of HashMap
HashMap Collision
Rehashing Process
Internal working of LinkedHashMap
Queue
What is Priority Queue
Concurrent Collections
Concurrent Collections
Concurrentmap in java
Why ConcurrentModificationException
What is ConcurrentHashMap
Internal Implementation of CHM
HashMap VS ConcurrentHashMap
What is CopyOnWriteArrayList
What is CopyOnWriteArraySet
Concurrent Map 2
Arraylist VS CopyOnWriteArrayList
put() VS putIfAbsent()
remove() method
replace() method
Collection Sorting
Comparable
Comparator
Comparable VS Comparator
Sort by multiple fields
Extra
Legacy class
Arrays class
What is Collections
Collection VS Collections
immutable object

what is linkedlist in java


What is LinkedList in java

LinkedList is one of the implementation class of List interface which is use to store element using doubly linked list.

LinkedList allows duplicate elements and it maintains insertion order.

LinkedList class use to store element node by node and each node will have three fields data field, link field reference.

Points to remember about LinkedList

  1. In LinkedList insertion order is preserved.
  2. In LinkedList duplicate objects are allowed.
  3. In LinkedList null insertion is possible.
  4. It implements Serializable and Cloneable interface but not RandomAccess interface.
  5. LinkedList class is not synchronized

When to use LinkedList in java

If our operation is to insert element delete element in middle frequently  then we should use LinkedList.

Default size of LinkedList

LinkedList by nature does not have “capacity”, since it does not allocate memory to the items before the items are added to the list. Each item in a LinkedList holds a pointer to the next element address in the list.

Example

import java.util.*;
class LinkedDemo 
{
	public static void main(String[] args) 
	{
		LinkedList v=new LinkedList();
		v.add("Vikash");
		v.add("Vicky");
		v.add("Yogesh");
		Iterator itr=v.iterator();
		while(itr.hasNext())
		{
                   System.out.println(itr.next());
		}
	}
}






Full-stack web and mobile app development company Contact Us : Skype: indore.webcoder Email: info@w3sparks.com Sales: +91 8085506229