Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘hashCode’

HashSet Buckets And HashCode In Java

Items in Separate Buckets

In the past Java HashSet example, we learnt about the Java HashSet and its Set implementation and how it keeps the uniqueness. Now, in this example, we will learn about the Buckets and how it aids quicker retrieval and search. These buckets improve the performance of search action and this example will research how these bucketing concepts work with HashSet Class and hashCode override of its stored object.

Continue Reading →

ArrayList – Java Collection

Adding Elements to Array List Shifts The Index

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.

Continue Reading →