After Adding Obj4 to LinkedList

Java LinkedList vs ArrayList – Performance

In this example, we will learn about Java’s LinkedList Collection and will compare that with the ArrayList. We will study how each structure holds its merits & demerits in terms data structure change and data fetch.

The Java’s LinkedList Collection implements both List and Dequeue. In the past example, we saw an ArrayList which implements only the List interface. As LinkedList also implements the List, we can get same behaviour offered by ArrayList in LinkedList as well. In this example, we will see the List implementation over the LinkedList and compare its performance with ArrayList.

Adding Elements to Array List Shifts The Index

ArrayList – Java Collection

ArrayList is the most often used collection object in Java. Before we learn about the ArrayList, first we will have a basic idea about the Java’s collection.

Java provides Collection Frame-Work for storing and reclaiming the objects. In this Collection Frame-Work group of classes and interfaces are packed to act on the group of objects. Arrays are fixed in size. Whereas collection grows when we add objects to it. Collection classes implement the set of interfaces and there by giving the set of functionalities. Unlike arrays, collection can store only objects and to store Std. types we should keep them as objects via Boxing concept.


Custom Exception in Java – Creating & Using

In Java there are many Exception types to handle a unique exception. There are groups like security related exceptions, file handling related exception and DB operation related exceptions, etc. If you want to handle an exception that is more exact to your business Logic, you can go for ‘Custom Exception’. Before we move on to the topic, let us learn Exception Category and this will help us decide what kind of exception we can create.

Exception Bubbling in Java

Exception Bubbling in Java

In java and modern OOPS language, an Exception moving from one method to other method is what we call as Exception Bubbling. In java, a method can call other method. The Called method can call one more method. These kinds of calling sequence continue and we can see all the methods in a call stack for a given point in time.

1 2 3 4 5 6