Skip to content

Latest commit

 

History

History
26 lines (20 loc) · 1.54 KB

File metadata and controls

26 lines (20 loc) · 1.54 KB

Java Design Snippets

Welcome! This repository is a collection of concise and practical Java implementations designed to help new developers understand key coding constructs, algorithms, and system design patterns. Ideal for interview prep, hands-on learning, and sharpening your Java skills.

Topics Covered

  • Java basics (strings, recursion, arrays) - (COMING UP)
  • Custom data structures (e.g., LRU Cache, Stack)
  • Classical algorithms (sorting, searching, graphs) - (COMING UP)
  • Concurrency (threading, producer-consumer) - (COMING UP)
  • Design patterns (singleton, factory, observer) - (COMING UP)
  • System design components (rate limiter, circuit breaker)

How to Use

  • Browse folders by topic
  • Each subfolder contains:
    • Java implementation
    • Minimal usage example or test
    • README explaining logic and concepts

Featured Implementations

  • Raft Consensus Algorithm: A complete, from-scratch implementation of the Raft algorithm, demonstrating leader election, log replication, and fault tolerance.
  • LRU Cache: An efficient, thread-safe Least Recently Used (LRU) cache using a HashMap and a Doubly Linked List for O(1) get and put operations.
  • Circuit Breaker: A classic stability pattern to prevent cascading failures in distributed systems.
  • Consistent Hashing: A clear demonstration of consistent hashing, including an advanced version with virtual nodes for better key distribution.