Posts

How HashMap work in Java

Image
If someone had asked me a year ago how HashMap works, I would've confidently said, "It's just a key-value pair that uses hashing to store data." Technically, I wasn't wrong. But I wasn't completely right either. While preparing for interviews, I decided to go beyond the definition. That's when I discovered what actually happens inside a HashMap. It isn't just a collection of random buckets. At its core, HashMap uses a dynamic array. Each position in that array is called a bucket. When you insert a key, Java calculates its hashCode() to decide which bucket it belongs to. But what if two different keys end up in the same bucket? That's called a collision. Instead of overwriting the existing value, HashMap stores both entries together. Java then uses equals() to identify the correct key when retrieving data. Earlier versions stored collided entries as a Linked List. But in Java 8 and above, if too many entries accumulate in the same bucket (and the ta...

🚀 Apache Kafka vs RabbitMQ: Which One Should You Choose?

  🚀 Apache Kafka vs RabbitMQ: Which One Should You Choose? 💡 Both Apache Kafka and RabbitMQ are powerful messaging technologies used in modern distributed systems and microservices architecture. But do you know when to use each one? 🔵 Apache Kafka ✅ Designed for high-throughput, real-time event streaming ✅ Handles millions of messages efficiently ✅ Stores events for configurable retention periods ✅ Ideal for event-driven architectures, log aggregation, and stream processing 🟠 RabbitMQ ✅ Reliable message delivery between applications ✅ Supports flexible routing using exchanges and queues ✅ Ideal for background jobs, task queues, and asynchronous communication ✅ Supports protocols such as AMQP, MQTT, and STOMP 🔥 Key Takeaway: 👉 Choose Kafka when you need high-throughput event streaming, event replay, and scalable data pipelines. 👉 Choose RabbitMQ when you need flexible message routing, task distribution, and reliable asynchronous communication.

Java Microservices Interview Questions 2026 Experience: 3 to 6 Years

Java Microservices Interview Questions 2026 Experience: 3 to 6 Years 𝗖𝗢𝗥𝗘 𝗝𝗔𝗩𝗔: 1. Fail-fast vs fail-safe iterators. 2. How does ConcurrentHashMap work internally? 3. What happens when a thread pool’s work queue reaches capacity? 4. What are the consequences of using a mutable object as a HashMap key? 5. Explain SOLID principles with a real-world example. 6. Optional: orElse() vs orElseGet(). 7. Your service throws OutOfMemoryError in production. What are your first diagnostic steps? 8. Virtual threads: when do they improve scalability, and where do they fall short? 𝗦𝗣𝗥𝗜𝗡𝗚 𝗕𝗢𝗢𝗧 𝗔𝗡𝗗 𝗠𝗜𝗖𝗥𝗢𝗦𝗘𝗥𝗩𝗜𝗖𝗘𝗦: 1. How does JWT-based authentication work? 2. What is the difference between OAuth2 and JWT? 3. RestTemplate vs WebClient vs RestClient. 4. How do microservices communicate with each other? 5. What is the role of an API Gateway? 6. How do you implement global exception handling in Spring Boot? 7. How does @Transactional work internally? 8. Why does @Transactio...

Architecting with Google Kubernetes Engine: Foundations

Image
 Architecting with Google Kubernetes Engine: Foundations is a Google Cloud course that teaches you how to run containerized applications using Kubernetes on Google Cloud. It is the first course in the GKE learning series.   Architecting with Google Kubernetes Engine: Foundations By Google Cloud Training Intermediate Hands-on labs Learn cloud infrastructure, containers, and Kubernetes architecture. Open the official Google Skills course What you will learn 1. Introduction to Google Cloud Cloud computing and Google Cloud Platform (GCP) Regions, zones, and resource hierarchy Compute Engine and other compute options Cloud Console and Cloud Shell 2. Containers and Kubernetes What containers and Docker images are Building container images with Cloud Build Storing images in a registry Why Kubernetes is used 3. Kubernetes architecture Pods and Nodes Control plane and worker nodes Deployments, ReplicaSets, and Services Creating a GKE cluster and deploying applications Topics summarize...