🤯 Yesterday I learned that ArrayList is dynamic… Today I explored how it actually grows internally in Java. Here’s the simple idea 👇 👉 ArrayList internally uses a normal array 👉 When the array becomes full, Java creates a new bigger array 👉 Old elements are copied into the new one 👉 Capacity usually increases by 1.5x Example: 10 → 15 → 22 → 33 This is what makes ArrayList flexible while still being fast. 💡 Key takeaway: ArrayList looks dynamic from outside, but internally it still depends on arrays + resizing logic. Small internal details like this make Java collections much more interesting. #Java #ArrayList #DSA #LearningInPublic
ArrayList Resizing Explained in Java
More Relevant Posts
-
Day 94/100 – Consistency Journey Today’s focus: Strings in DSA + Java Multithreading Practiced string problems involving sliding window, two pointers, and pattern-based thinking. Realized how much efficiency improves when you move from brute force to optimized approaches. On the backend side, explored ExecutorService in Java — understanding how thread pools help manage multiple tasks efficiently instead of creating threads manually every time. Key takeaway: DSA builds problem-solving mindset, while backend concepts like multithreading show how things actually scale in real-world systems. Slowly connecting both worlds. Consistency > Motivation. #Day94 #100DaysOfCode #DSA #Java #BackendDevelopment #LearningInPublic
To view or add a comment, sign in
-
-
Today I learned the difference between ArrayList and LinkedList in Java Collections. Both allow null values and duplicate elements, but they differ in performance and internal structure: 🔹 ArrayList: * Backed by a dynamic array * Faster for accessing elements (random access) * Slower for insertions and deletions (especially in the middle) * Provides three constructors 🔹 LinkedList: * Based on a doubly linked list * Faster for insertions and deletions * Slower for accessing elements (sequential traversal) * Provides two constructors Understanding when to use each helps in writing more efficient and optimized code. #Java #Collections #LearningJourney #DataStructures #TapAcademy
To view or add a comment, sign in
-
-
Day 51 – Understanding Static Concepts in Java ☕ Today I learned about static variables, static methods, and static blocks in Java. Topics covered: 🔹 Static variables and their shared nature across objects 🔹 Static methods and how they can be accessed without creating objects 🔹 Static blocks and their role in initialization Understanding how static members belong to the class rather than objects helped me gain better clarity on memory usage and execution flow in Java. Strengthening my understanding of Java internals step by step 🚀 #Day51 #JavaJourney #CoreJava #Static #JVM #Consistency
To view or add a comment, sign in
-
Day 92 - LeetCode Journey Solved LeetCode 143: Reorder List in Java ✅ This problem looks tricky at first, but once you break it into steps, it becomes clean and elegant. The idea is simple: 1️⃣ Find the middle of the list (slow-fast pointers) 2️⃣ Reverse the second half 3️⃣ Merge both halves alternately That’s it. Three steps, one solid solution. Key takeaways: • Mastering slow & fast pointer technique • In-place reversal of linked list • Merging two lists efficiently • Breaking complex problems into smaller parts ✅ All test cases passed ⚡ O(n) time and O(1) space Problems like this build real confidence in linked lists 💯 #LeetCode #DSA #Java #LinkedList #ProblemSolving #CodingJourney #InterviewPrep #Consistency #100DaysOfCode
To view or add a comment, sign in
-
-
LeetCode Practice - 11. Container with Most Water The program is solved using JAVA. 🔑 Logic Summary 1. Take two pointers (start and end) 2. Calculate area 3. Store max area 4. Move smaller height pointer 5. Repeat until pointers meet #LeetCode #Java #CodingPractice #ProblemSolving #DSA #Array #DeveloperJourney #TechLearning
To view or add a comment, sign in
-
-
💻 Day 25– Exception Handling in Java Today I learned about Exception Handling and honestly… this is something every program needs. Like when errors happen (divide by zero, wrong input, etc.) instead of crashing → we can handle it properly. Things I understood: 👉 try – risky code 👉 catch – handles the error 👉 finally – always runs 💡 Main thing: Errors are normal… handling them properly is what matters. Slowly getting into writing clean & reliable code 😌 #Java #CodingJourney #LearningInPublic #Day25 #100DaysOfJava
To view or add a comment, sign in
-
-
Day 36/100 – Working with ArrayList in Java 📚 Today I practiced using ArrayList in Java, a dynamic array that allows flexible storage and manipulation of data. Unlike normal arrays, ArrayList can grow and shrink dynamically, making it very useful in real-world applications. Key learnings: • Adding elements using add() • Storing multiple values dynamically • Finding size using size() • Easier and more flexible than traditional arrays Understanding collections like ArrayList is important for handling data efficiently in Java. Building strong fundamentals step by step. 🚀 #100DaysOfCode #Java #ArrayList #DataStructures #CodingJourney #LearningInPublic
To view or add a comment, sign in
-
-
Solved Simple Array Sum using LinkedList in Java 8 💻📊 Today I worked on the Simple Array Sum problem and implemented it using LinkedList in Java 8. 💡 What I learned: How to convert a List into a LinkedList Traversing elements efficiently using loops Using Java 8 Streams for cleaner and shorter code ⚙️ Approach: Converted input list into a LinkedList Iterated through elements and calculated sum Also explored stream().mapToInt().sum() for optimized solution 📌 Key Takeaway: Even simple problems help strengthen core concepts like data structures and improve coding efficiency. ⚡ Time Complexity: O(n) ⚡ Space Complexity: O(n) 👨💻 Consistent practice is helping me improve my problem-solving skills step by step. #Java #Java8 #LinkedList #Coding #ProblemSolving
To view or add a comment, sign in
-
-
Took a simple one today: replace spaces with "%20" Looks trivial until you remember… Java strings don’t change. So instead of “fixing” the string, you just build a new one while scanning through it. Kinda interesting how a basic problem quietly checks whether you understand immutability or just blindly try to edit things in place. #GeeksForGeeks #ProblemOfTheDay #LearningInPublic
To view or add a comment, sign in
-
-
Leetcode Practice - 12. Integer to Roman The program is solved using JAVA We store values in descending order 👉 Then: Loop through values If number ≥ value → append symbol Subtract value Repeat #LeetCode #Java #StringHandling #CodingPractice #ProblemSolving #DSA #DeveloperJourney #TechLearning
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
What Java collection topic should I explore next? 👀 1️⃣ LinkedList vs ArrayList2️⃣ HashSet internals3️⃣ HashMap vs Hashtable Would love your suggestions 👇