We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Category: java

Java Constructor Tutorial – Why do we need Constructors ?

In this article we will discuss need and usage details of constructors in Java. What is a Constructor ? Constructor is a member function of the class that is used to initialize a newly constructed object i.e. initializing the member variables of object. Advertisements It has the same name as of the class. Why do …

Java Constructor Tutorial – Why do we need Constructors ?Read More

How to add elements in a LinkedList in Java

In this article we will discuss how to add elements in LinkedList and then display them. Lets create a LinkedList of String i.e. Advertisements List<String> listOfStr = new LinkedList<>(); To add elements in LinkedList we will use its add() function i.e. boolean add(E e) add() member function of LinkedList always appends the element in the …

How to add elements in a LinkedList in JavaRead More

How to add elements at a particular index in LinkedList

In this article we will discuss how to add elements at a particular index or position in a LinkedList in Java. add() member function of LinkedList always appends the element at the end of LinkedList. Now suppose we don’t want to add element at the end of Linked List instead of it we want to add element somewhere …

How to add elements at a particular index in LinkedListRead More

How to iterate over a LinkedList in Java

In this article we will discuss how to iterate over a LinkedList Collection in Java and access objects. To fetch the Iterator from a LinkedList object use following member function, Advertisements ListIterator<E> listIterator(); It will return ListIterator object that implements Iterator that provides functions to iterate over the LinkedList object. It manages an internal Cursor which is …

How to iterate over a LinkedList in JavaRead More

How to iterate LinkedList in reverse or backward direction

In this article we will discuss how to iterate over a LinkedList in reverse order. Method 1 : Using Descending Iterator Iterator<E> descendingIterator() Descending Iterator returns the Iterator that points to the end of of List i.e. LinkedList<String> listOfStr = new LinkedList<>(); // Get Descending List Iterator from List Object Iterator<String> listItReverse = listOfStr.descendingIterator(); Now calling function …

How to iterate LinkedList in reverse or backward directionRead More

Cart

Your Cart is Empty

Back To Shop