SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

CORE API / NOTES</>↗
Core API07 Nov 2009

How do I insert an item into LinkedList?

To insert an item at any position into a linked list object we can use the add(int index, Object o) method. This method takes the index to where the new object to be inserted and the object to be inserted itself. package org.kodejava.util; import java.util.LinkedList; public class LinkedListAddDemo { public static void main(String[] args) { […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API03 Nov 2009

How do I add item at the beginning or the end of LinkedList?

To add an item before the first item in the linked list we use the LinkedList.addFisrt() method and to add an items after the last item in the linked list we use the LinkedList.addLast() method. package org.kodejava.util; import java.util.LinkedList; public class LinkedListAddItems { public static void main(String[] args) { LinkedList<String> grades = new LinkedList<>(); grades.add("B"); […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API30 Oct 2009

How do I remove the first and last item from LinkedList?

To remove the first or the last elements from the linked list we can use the removeFirst() and removeLast() methods provided by the LinkedList class. package org.kodejava.util; import java.util.LinkedList; public class LinkedListRemoveItems { public static void main(String[] args) { LinkedList<String> grades = new LinkedList<>(); grades.add("A"); grades.add("B"); grades.add("C"); grades.add("D"); grades.add("E"); grades.add("F"); System.out.println("Original values are:"); Sy...

Wayan · 1 min read
CORE API / NOTES</>↗
Core API26 Oct 2009

How do I retrieve particular object from LinkedList?

The example show you how to retrieve particular object from LinkedList using the indexOf() method. package org.kodejava.util; import java.util.List; import java.util.LinkedList; public class LinkedListIndexOf { public static void main(String[] args) { List<String> names = new LinkedList<>(); names.add("Alice"); names.add("Bob"); names.add("Carol"); names.add("Mallory"); // Search for Carol using the indexOf method. This method // returns the index of […]

Wayan · 1 min read
CORE API / NOTES</>↗
Core API22 Oct 2009

How do I iterate LinkedList elements using ListIterator?

This example show you how to use the ListIterator interface to iterate elements of a LinkedList. package org.kodejava.util; import java.util.List; import java.util.LinkedList; import java.util.ListIterator; public class LinkedListListIterator { public static void main(String[] args) { List<String> grades = new LinkedList<>(); grades.add("A"); grades.add("B"); grades.add("C"); grades.add("D"); grades.add("E"); // Retrieves object from LinkedList using the ListIterator // inter...

Wayan · 1 min read
CORE API / NOTES</>↗
Core API18 Oct 2009

How do I iterate LinkedList elements using Iterator?

This example show you how to use the Iterator interface to iterate elements of a LinkedList. package org.kodejava.util; import java.util.List; import java.util.LinkedList; import java.util.Iterator; public class LinkedListIterator { public static void main(String[] args) { List<String> grades = new LinkedList<>(); grades.add("A"); grades.add("B"); grades.add("C"); grades.add("D"); grades.add("E"); // Iterates elements in LinkedList using Iterator. Iterator<String> iterator =...

Wayan · 1 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.