Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!

 

1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

 

and many more ....

 

 

Insert element at specific index in LinkedList example

With this example we are going to demonstrate how to insert an element at a specific index in a LinkedList. In short, to insert an element at a specific index in a LinkedList you should: Create a LinkedList. Populate the list with elements, with add(E e) API method. Invoke add(int index , Object element) API method of LinkedList. It inserts ...

Read More »

Obtain sub List from LinkedList example

This is an example of how to obtain a subList of a LinkedList, that is a view to a specified range of the list. Getting a sublist of a LinkedList implies that you should: Create a new LinkedList. Populate the list with elements, with add(E e) API method of LinkedList. Invoke the subList(int fromIndex, int toIndex) API method of LinkedList. ...

Read More »

Get first and last elements in LinkedList example

In this example we shall show you how to get the first and the last elements of a LinkedList. The LinkedList class provides methods for these operations. To get the first and the last elements of a LinkedList one should perform the following steps: Create a new LinkedList. Populate the list with elements, with add(E e) API method of LinkedList. ...

Read More »

Get element at specific index of LinkedList example

With this example we are going to demonstrate how to get an element at a specific index of a LinkedList. The LinkedList API provides methods to do such operations. In short, to get an element of a LinkedList, giving an index as parameter you should: Create a new LinkedList. Populate the list with elements, with add(E e) API method of ...

Read More »

Convert LinkedList to Object array example

This is an example of how to convert a LinkedList to an Object array. Converting a LinkedList to an array implies that you should: Create a new LinkedList. Populate the list with elements, with add(E e) API method of LinkedList. Get an array containing all of the elements in this list in proper sequence (from first to last element), using ...

Read More »

Check for element existence in LinkedList example

In this example we shall show you how to check if an element exists in a LinkedList or not. To check an element existence in a LinkedList one should perform the following steps: Create a new LinkedList. Populate the list with elements, with add(E e) API method of LinkedList. Check if an element exists in the list, with contains(Object o) ...

Read More »

Add elements at the beginning and end of LinkedList example

With this example we are going to demonstrate how to add elements in the start and the end of a LinkedList. The LinkedList API provides methods to do such operations. In short, to add elements in the start and the end of a LinkedList you should: Create a new LinkedList. Populate the list with elements, with add(E e) API method ...

Read More »

Obtain tail Set from TreeSet example

This is an example of how to obtain a tail Set of TreeSet, using the tailSet(E fromElement) method . The method returns a view of the portion of this set whose elements are greater than or equal to fromElement. In order to use it you should: Create a new TreeSet. Populate the set with elements, with add(E e) API method ...

Read More »

Obtain sub Set from TreeSet example

In this example we shall show you how to obtain a sub set from a TreeSet. We will use the subSet(E fromElement, E toElement) API method of TreeSet. To obtain a sub set from a TreeSet, one should perform the following steps: Create a new TreeSet. Populate the set with elements, with add(E e) API method of TreeSet. Invoke the ...

Read More »

Obtain lowest and highest values from TreeSet example

With this example we are going to demonstrate how to obtain the lowest and highest values of a TreeSet. The TreeSet API provides us with methods for such operations. In short, to obtain lowest and highest values of TreeSet you should: Create a new TreeSet. Populate the set with elements, with add(E e) API method of TreeSet. Get the lowest ...

Read More »