One Notes Documentation

website·Indexed 29 days ago

https://ritiksharma142001.github.io/one-notes

A comprehensive collection of technical notes covering Core Java (OOPS, Collections, Multithreading, and JRE), React, MongoDB, MySQL, Node.js, Shell scripting, Git, GitHub, CSS, and Tailwind CSS. The Java section provides detailed guides on inheritance, polymorphism, abstraction, encapsulation, and the Java Collections Framework.

Tokens
39.9K
Snippets
202
Records
259
Agent score
75%

What's inside One Notes

  1. Overview of Java Collection Framework main classes

    The Java Collection Framework provides several core implementations for managing data structures, each with different performance characteristics and ordering guarantees.
    ClassDescription
    ArrayListA resizable array implementation of the List interface.
    LinkedListA doubly-linked list implementation, suitable for frequent insertions and deletions.
    HashSetA collection that stores unique elements with no specific order.
    TreeSetA sorted collection that maintains elements in ascending order.
    HashMapA key-value pair storage that allows fast retrieval of elements.
    TreeMapA sorted key-value storage that keeps keys in ascending order.
    PriorityQueueA queue that processes elements based on priority rather than insertion order.
  2. Introduction to Java Stream API

    The Stream API, introduced in Java 8 and located in the java.util.stream package, provides a sequence of elements that supports functional-style operations to process data. Unlike Collections, which are used to store groups of objects, Streams are used to process those objects. Key characteristics include support for lazy evaluation (operations are only performed when necessary) and internal iteration, meaning the stream handles looping internally rather than requiring manual for loops.
    import java.util.stream.*;
  3. Overview of the Java Collection Interface

    The Collection interface is the root interface of the Java Collections Framework. It defines the fundamental operations for managing groups of objects, which are implemented by more specialized collection types. Key interfaces that extend Collection include:

    • List: Ordered collections that allow duplicate elements (e.g., ArrayList, LinkedList).
    • Set: Unordered collections that ensure unique elements (e.g., HashSet, TreeSet).
    • Queue: Collections following the First-In-First-Out (FIFO) principle (e.g., PriorityQueue, LinkedList).
    • Deque: Double-ended queues allowing addition/removal from both ends (e.g., ArrayDeque).
  4. Advantages of Java Collection Framework over Arrays

    The Collection Framework is designed to overcome the limitations of standard Java arrays:

    • Dynamic Sizing: Unlike arrays, which have a fixed size upon creation, collection classes like ArrayList and LinkedList can grow or shrink dynamically.
    • Heterogeneous Data: Collections can store different types of data (though generics are typically used for type safety).
    • Memory Efficiency: Arrays require contiguous memory locations, which can lead to allocation issues; collections provide more flexible data structures.
    • Built-in Utilities: The framework provides predefined methods for common tasks such as sorting, searching, and manipulating data.
  5. Understand Classes and Objects in Java

    In Java, a class serves as a blueprint for an object, defining its properties (data members) and behaviors (member functions). An object is a concrete programming representation of a class, with its memory allocated in the Heap section of the memory segment. Java is an Object-Oriented Programming (OOP) language based on four main principles: Encapsulation, Inheritance, Polymorphism, and Abstraction.
  6. Understand Java String immutability and the String Pool

    Strings in Java are immutable, meaning once a String object is created, its value cannot be changed. To optimize memory, Java uses a String Pool, where string literals are stored. Using new String("text") bypasses the pool and creates a new object on the heap, even if the same string already exists in the pool.
  7. Understand the Java Runtime Environment (JRE)

    The JRE (Java Runtime Environment) is the software layer that provides the environment necessary to execute Java applications. It is responsible for running already compiled Java programs (.class files) and does not perform compilation. The JRE ensures consistent program execution across different systems.
  8. Understand the Java Execution Architecture (JDK, JRE, JVM)

    Java uses a layered architecture to execute code:

    • JDK (Java Development Kit): The full development environment. Contains javac (compiler), developer tools (debuggers), and the JRE.
    • JRE (Java Runtime Environment): The subset of the JDK needed to run programs. Contains the JVM and Java Class Libraries (API).
    • JVM (Java Virtual Machine): The engine that runs bytecode. It consists of:
      • Class Loader: Loads .class files.
      • Bytecode Verifier: Ensures security and validity.
      • Execution Engine: Contains the Interpreter (line-by-line execution) and the JIT Compiler (compiles bytecode to native machine code for performance).
  9. Compare Manual and Automation Testing

    Software testing is divided into two primary approaches:

    • Manual Testing: The process of testing software by hand without automated tools or scripts. Testers execute test cases manually to identify bugs.
    • Automation Testing: The process of using automation tools or scripts (e.g., Selenium) to execute test cases more efficiently and faster.
  10. Understand the Linux Shell and Bash

    A Shell is a program that acts as an interface between the user and the Linux OS, passing commands to the kernel. Bash (Bourne Again Shell) is a specific implementation of a shell and is the most commonly used default shell in most Linux distributions (such as Ubuntu and Debian). Other examples of shells include sh (Bourne Shell), zsh, fish, and ksh.
  11. Understand Boxing and Unboxing in Java

    Java provides mechanisms to convert between primitives and their corresponding wrapper objects:

    • Boxing: Converting a primitive data type into its wrapper class object.
    • Autoboxing: Automatic conversion from primitive to wrapper object performed by the Java compiler.
    • Unboxing: Converting a wrapper class object back into a primitive data type.
    • Auto-Unboxing: Automatic conversion from wrapper object to primitive performed by the Java compiler.
  12. Understand Java Strong Typing and Variable Declaration

    Java is a strongly typed programming language, requiring every variable to have a defined data type at the time of declaration. This allows the compiler to verify the kind of data being stored and prevents execution errors.
    int age = 25;         // 'int' stores whole numbers
    String name = "John"; // 'String' stores text