Skip to main content

Posts

Showing posts with the label HashMap

πŸ₯‘πŸ₯’JSON vs HashMap — Why They’re Cousins, Not Twins! πŸ₯‘πŸ₯’

πŸ— Structure 1️⃣ Setting the Scene — The Confusion Moment πŸ€” "I thought JSON was just a HashMap in a superhero costume!!" Nope! It’s like saying Spring Boot is just Spring MVC with coffee ☕ — there’s way more going on. 2️⃣ πŸ’‘ What is a HashMap? Java-only data structure Stores key-value pairs in memory (heap) Keys can be anything — Integer, String, custom objects (if hashCode() & equals() are implemented properly) Not meant for network transfer πŸ“¦ Example: Map<Integer, String> studentMap = new HashMap<>(); studentMap.put(101, "Anand"); studentMap.put(102, "Priya"); This stays inside your JVM. If you try to send it over HTTP as-is… good luck explaining it to a Python service. 🐍πŸ’₯ 3️⃣ πŸ“ What is JSON? Language-independent data format (Java, Python, JS, Go, you name it) Stores only String...