Learnitweb

Category: Java tutorial

  • 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…

  • ‘this’ keyword in JavaScript

    1. Introduction The this keyword is one of the most perplexing concepts in JavaScript. The confusion arises from the fact that its value is determined differently depending on the context in which it is used. The this keyword can be used in different contexts: inside functions, global scope, inside modules, etc. 2. Function context The…

  • Collectors partitioningBy() method in Java

    1. Introduction In Java, the Collectors class provides various methods to collect data from streams. One of the most powerful and frequently used methods is Collectors.partitioningBy(). This method is used to partition a stream of elements into two groups based on a given predicate. It returns a Map with Boolean keys (true and false) and…