Tag: Java Basics

Core Java

LinkedList In Java

Introduction: A LinkedList is a linear data-structure composed of nodes. In a singly linked list, each node contains data and a reference. Here, the reference-part refers to the next node in the linked list. In a doubly linked list, on the other hand, we have data and references to both previous and next nodes. Java […]

Be the First to comment. Read More
Core Java

Java UUID

Introduction: UUID (Universal Unique Identifier) represents a 128-bit long unique value. It’s also popularly known as GUID (Globally Unique Identifier). The standard representation of UUID is made up of hexadecimal digits: 533a4559-e55c-18b3-8456-555563322002 And has 36 characters that include four hyphens ‘-‘. java.util.UUID class in Java represents an immutable UUID. We can use UUID class for […]

Be the First to comment. Read More
Core Java

Java TreeMap vs HashMap

Introduction: In this quick post, we’re gonna look at the similarities as well as the differences between Java HashMap and TreeMap. Similarities: Before we dive into the differences between Java HashMap and TreeMap, let’s first look at their similarities: Both extend java.util.AbstractMap class and are part of Java Collections API Both of these Map implementations aren’t […]

Be the First to comment. Read More
Core Java

Java DAO Pattern

Introduction: The DAO or the Data Access Object pattern is a very popular structural design pattern that separates the persistence logic in a separate layer. The idea is to abstract or hide the database logic from the business layer. It helps in hiding unnecessary CRUD operation and storage details from our service layer so that […]

2 comments Read More
Core Java

Java ClassLoaders

Introduction: In this tutorial, we’ll learn what is a classloader in Java. We’ll also look at various types of available Java Classloaders. A Classloader in Java is responsible for loading the required classes in memory dynamically at runtime. The classes aren’t loaded in memory all at once but rather when really needed by the application. […]

Be the First to comment. Read More
Core Java

Pairs In Java

Introduction: A Pair is an abstract data type which stores two items together which may or may not be related. They come handy when we want to track two objects together. We often feel the need to work with Pairs, specifically in competitive programming problems. In this tutorial, we’ll cover ways to define or use […]

Be the First to comment. Read More
Core Java

Check If Java Array Contains a Given Value

Introduction: In this quick tutorial, we’ll look at how to find if a Java array contains a given value. In other words, we’ll check if a given value is present in our Java array or not. Linear Search: One of the most straightforward approaches would be to linearly search our array to check if it […]

Be the First to comment. Read More
Core Java

Binary Search In Java

Introduction: In this quick tutorial, we’ll learn to perform a binary search in a sorted array. We’ll also write our own algorithmic implementation in Java. Later, we’ll discuss the binarySearch() method available in the Java library. Problem Definition: Let’s say we have a sorted array a[]: int[] a = {1, 2, 3, 4, 5, 6}; […]

Be the First to comment. Read More
Core Java

Polymorphism In Java

Introduction: Polymorphism in Java provides us an ability by which an object can take on different forms based on our usage context. Polymorphism is derived from two words – “poly” which means “many” and “morphs” which means “forms”. Java defines two major types of polymorphism: Compile-time / Static Polymorphism also referred to as “Method overloading” […]

Be the First to comment. Read More
Core Java

Find Middle Element In a Linked List

Introduction: In this quick tutorial, we’ll first start by looking at the brute-force solution to find the middle element in the linked list. Later, we’ll learn how to achieve it in a single iteration through the entire linked list i.e. in just a single pass. Problem Definition: Given a linked list L, our aim is […]

Be the First to comment. Read More