Learnitweb

Category: Java tutorial

  • Daemon Threads in Java

    1. Introduction to Threads in Java In Java, threads are used to perform tasks concurrently. There are two types of threads: 2. What is a Daemon Thread? A Daemon Thread in Java is a thread that runs in the background and does not prevent the JVM from exiting. Examples of daemon threads: These threads are…

  • Java Collection Framework – An Introduction

    1. Introduction The Java Collection Framework (JCF) is a unified architecture for storing and manipulating groups of data. It provides a set of interfaces and classes that support a wide variety of data structures including lists, sets, queues, and maps. Collection Framework Hierarchy (Textual Diagram) 2. Core Interfaces and Classes 2.1 Collection Interface 3. List…

  • Hashing in Java

    1. What is Hashing? Hashing is the process of converting an input of arbitrary length (like a string, file, or object) into a fixed-size numeric or alphanumeric value, known as the hash code or hash value. It’s a core concept in computer science and widely used in: 2. Key Characteristics of Hashing 3. Logic to…

  • How HashSet Works Internally in Java

    HashSet is a part of the Java Collection Framework and implements the Set interface, which is a collection that does not allow duplicate elements. It is backed by a HashMap internally, where each element in the HashSet is stored as a key, and the corresponding value is a constant dummy value. HashSet leverages hashing to…

  • How HashMap Works Internally in Java

    A HashMap in Java is a key-value based data structure that allows fast data access by leveraging a technique called hashing. It is part of the java.util package and is widely used due to its average constant time complexity (O(1)) for insertion and retrieval operations. Core Internal Concepts Behind HashMap 1. Hashing Mechanism This supplemental…

  • Dequeue in Java

    The Deque (Double-Ended Queue) interface in Java is part of the java.util package and provides a more flexible and efficient way to handle collections. It supports the insertion and removal of elements from both ends of the queue, which makes it versatile for implementing both FIFO (First-In-First-Out) and LIFO (Last-In-First-Out) behaviors. Key Methods of Deque…

  • Array.prototype.splice() method

    1. Overview The splice() method modifies an array directly by adding, removing, or replacing elements at specific positions. The splice() method is a mutating method. It may change the content of this. If the specified number of elements to insert differs from the number of elements being removed, the array’s length will be changed as…

  • A06:2021 – Vulnerable and Outdated Components

    1. Overview The Vulnerable and Outdated Components category highlights risks associated with using software components, libraries, frameworks, or dependencies with known vulnerabilities or outdated versions. Modern applications often rely heavily on third-party components, which, if not properly managed, can expose systems to serious security risks. 2. Description You are likely vulnerable: 3. How to Prevent…

  • A02:2021 – Cryptographic Failures

    1. Overview A02:2021 – Cryptographic Failures is one of the security risks identified in the OWASP Top 10 for 2021. It highlights vulnerabilities caused by improper implementation, use, or management of cryptographic systems in applications. Cryptographic failures occur when sensitive data is inadequately protected. This category was previously called “Sensitive Data Exposure” but was renamed…

  • Handling time zones in distributed systems

    1. Introduction Managing dates and times in applications is a frequent but complex challenge that demands careful design and implementation to ensure accuracy. This complexity increases when applications cater to users worldwide, each operating in different time zones. Additionally, many countries—or even specific regions within them—observe Daylight Saving Time (DST), adding another layer of intricacy…