Day 66 of Java Full Stack Journey — List & ArrayList Basic Methods Today I worked on the Collection Framework, specifically the List interface and its popular implementation ArrayList. Key Points: List maintains insertion order Allows duplicate elements Elements can be accessed using index ArrayList is dynamic in size (grows automatically) Common Methods Used: add() → Add elements remove() → Remove elements (by index or condition) get() → Access elements using index set() → Update element at a specific index size() → Returns number of elements clear() → Remove all elements forEach() → Iterate using lambda function Learning Insight: ArrayList is efficient for data retrieval but not ideal for frequent insertions/removals in the middle since it shifts elements. 10000 Coders Gurugubelli Vijaya Kumar #java #ArrayList #List #100Days
Brahmaiah Talluri’s Post
More Relevant Posts
-
🚀 #Day56 of My Java Journey Today, I learned about Static Blocks and Non-Static (Instance) Blocks in Java. 𝟏. 𝐒𝐭𝐚𝐭𝐢𝐜 𝐁𝐥𝐨𝐜𝐤: ➜ Declared using the static keyword. 𝑺𝒚𝒏𝒕𝒂𝒙: static{ //statements } ➜ A static block runs only once, when the class is loaded into memory ➜ Executes before main method ➜ Mainly used for initializing static variables ➜ Static block executes only once per class loading, even if multiple objects are created. 𝟐. 𝐍𝐨𝐧-𝐒𝐭𝐚𝐭𝐢𝐜 / 𝐈𝐧𝐬𝐭𝐚𝐧𝐜𝐞 𝐁𝐥𝐨𝐜𝐤: ➜ No keyword 𝑺𝒚𝒏𝒕𝒂𝒙: { //statements } ➜ A non-static block runs each time an object is created. ➜ It executes just before the constructor. 𝙀𝙭𝙚𝙘𝙪𝙩𝙞𝙤𝙣 𝙁𝙡𝙤𝙬: Static Block → main() → Non-Static Block → Constructor 10000 Coders #Java #OOP #BlocksInJava #StaticBlock #InstanceBlock #LearningJourney #CodingEveryday #JavaProgramming
To view or add a comment, sign in
-
-
🚀 String Immutability (Java) Strings in Java are immutable, meaning that once a String object is created, its value cannot be changed. Any operation that appears to modify a String, such as concatenation or substring, actually creates a new String object. This immutability ensures that String objects can be safely shared and used in multi-threaded environments. Understanding string immutability is crucial for optimizing performance and avoiding unexpected behavior. 💡 Knowledge compounds faster than money — start learning today! 🎯 Learn efficiently — 10k concise concepts + 4k articles + 12k quiz questions. AI-personalized learning! 👇 Links available in the comments! #Java #JavaDev #OOP #Backend #professional #career #development
To view or add a comment, sign in
-
-
👨💻 Day 67 of My Java Full Stack Journey at 10000 Coders Topic of the Day: LinkedList Basics & Collection Methods in Java Today, I started learning about LinkedList in Java and explored commonly used Collection interface methods. 🔹 What is LinkedList? LinkedList is a data structure from the Java Collection Framework that stores elements in a node-based structure. Each element (node) contains: The data The reference to the next node (and previous in case of Doubly LinkedList) ✅ Key Features of LinkedList Dynamic size (grows & shrinks as needed) Faster insertion & deletion (compared to ArrayList) Stores duplicate values Maintains insertion order Best Use Cases: ✔ Frequent insertions or deletions ✔ Queue & Stack implementations 🔸 Important LinkedList Methods Used Today Method Purpose add() Add element addFirst() / addLast() Insert at beginning/end remove() Remove element removeFirst() / removeLast() Remove first/last node get() Access element at index size() Get size of list 🔹 Common Collection Methods revisited today Method Use add() Add element contains() Check existence remove() Remove element clear() Remove all elements isEmpty() Check if list is empty size() Get number of elements 🧠 Key Takeaways LinkedList is efficient for frequent insertion & deletion ArrayList = better for searching LinkedList = better for modifying data frequently Practiced Collection interface core methods again Understanding the right data structure improves performance & logic building. Grateful to 10000 Coders and my mentor Gurugubelli Vijaya Kumar for guiding me continuously with clear explanations and structured practice. #Day67 #JavaFullStack #10000Coders #LinkedList #CollectionsFramework #JavaLearning #DSA #CodingPractice #BackendDevelopment #JavaDeveloper #LearningJourney #CodeNewbie #DSAJourney
To view or add a comment, sign in
-
👨💻 Day 68 of My Java Full Stack Journey at 10000 Coders Topic of the Day: Vector Class & Its Methods in Java Collections Today, I learned about one of the legacy yet important classes in Java Collections — the Vector class. Even though it’s older, Vector still plays a vital role in understanding how data structures evolved in Java. 🔹 What is a Vector in Java? A Vector is a dynamic array similar to an ArrayList, but it is synchronized (thread-safe). It can grow or shrink automatically as elements are added or removed. ✔ Belongs to java.util package ✔ Implements List interface ✔ Supports random access just like ArrayList ✔ Ideal when multi-threaded access is required 🔸 Key Features of Vector Dynamic resizing of array Allows duplicates and null elements Maintains insertion order Synchronized, so it’s thread-safe but slightly slower Can be traversed using Iterator, Enumeration, or for-each loop 📦 Commonly Used Methods in Vector Method Description add(E e) Adds an element to the end of the vector add(int index, E element) Inserts element at specified position remove(int index) Removes element at the given index get(int index) Returns element at specified index set(int index, E element) Replaces element at given position size() Returns total number of elements clear() Removes all elements contains(Object o) Checks if element exists capacity() Returns the current capacity of the vectorfirstElement() / lastElement() Returns first or last element 🔁 Vector vs ArrayList Feature Vector ArrayList Synchronization ✅ Thread-safe ❌ Not synchronized Performance Slightly slower Faster Legacy Yes Modern alternative Iteration Enumeration, Iterator Iterator 🧠 Key Takeaways ✅ Vectors are synchronized and safe for multi-threaded programs. ✅ Though legacy, understanding them gives better insight into Java’s evolution. ✅ In modern development, ArrayList is preferred unless synchronization is required. ✅ Revisited all common Collection methods like add(), remove(), contains(), and size() today. Thanks to 10000 Coders and my mentor Gurugubelli Vijaya Kumar for explaining the concept with clarity and showing how older classes like Vector fit into modern Java Collections. #Day68 #JavaFullStack #10000Coders #VectorClass #JavaCollections #SynchronizedList #ArrayListVsVector #JavaLearning #DSA #OOP #CodeNewbie #LearningJourney #BackendDevelopment #Mentorship
To view or add a comment, sign in
-
🚀 String Concatenation: + operator vs. StringBuilder (Java) While the `+` operator can be used for string concatenation in Java, using `StringBuilder` is generally more efficient, especially when performing multiple concatenations. The `+` operator creates a new String object for each concatenation, which can lead to performance overhead. `StringBuilder`, on the other hand, modifies the string in place, avoiding the creation of unnecessary objects. For complex string manipulations, `StringBuilder` provides methods like `append()`, `insert()`, and `delete()`. 💪 Build skills, build wealth, build your future! 📖 Learn at your own pace — 10,000+ concepts, 4,000+ articles, 12,000+ quizzes. AI-guided learning! 🎓 Get started: https://lnkd.in/gefySfsc 🔗 Check it out: https://techielearn.in #Java #JavaDev #OOP #Backend #professional #career #development
To view or add a comment, sign in
-
-
👨💻 Day 64 of My Java Full Stack Journey at 10000 Coders Topic of the Day: Collection API Today I started learning about the Collection Framework / Collection API in Java. This is one of the most important topics for handling and manipulating data efficiently in real-world applications. 🔹 What is Collection API? The Collection API is a set of classes and interfaces in Java that allow us to store, process, and retrieve data efficiently. It provides built-in data structures like lists, sets, queues, and maps — eliminating the need to write our own data handling logic. 🎯 Why Collections? ✅ Handles dynamic data sizes (unlike arrays which are fixed) ✅ Provides ready-made data structures ✅ Supports searching, sorting, iterating, and modification ✅ Better performance and reusability 🔸 Key Interfaces in Collection Framework Interface Purpose List Stores ordered elements, allows duplicates Set Stores unique elements only Queue Follows FIFO structure Map Stores key-value pairs 📦 Common Classes ArrayList, LinkedList HashSet, TreeSet PriorityQueue, LinkedList (as Queue) HashMap, TreeMap 🧠 Concept Highlights Collections provide efficient data storage and retrieval More flexible than arrays Comes with many built-in useful methods like add(), remove(), contains(), size(), etc. Works with Generics for type safety 🙏 Thanks to 10000 Coders and my mentor for guiding me through foundational and advanced Java concepts. Excited to dive deeper into Lists, Sets, Maps, and Iterators in the coming sessions! Gurugubelli Vijaya Kumar #Day64 #10000Coders #Java #CollectionFramework #CollectionAPI #JavaLearning #FullStackDeveloper #LearningJourney #TechTraining #CodeNewbie
To view or add a comment, sign in
-
-
⚡ Why composition beats inheritance in real-world Java projects Early in my career, I used to rely heavily on inheritance. It felt natural: extend a class, reuse its behavior, done. But the deeper I went into backend development, the more often inheritance became a trap — especially in large codebases. Here’s why I now prefer composition over inheritance in most cases: ✅ 1. Composition keeps your code flexible With inheritance, you get a fixed structure. With composition, you build behavior dynamically by combining small, focused components. It’s the difference between: “I am a…” vs. “I can do…” ✅ 2. Testing becomes dramatically easier A deeply nested hierarchy is a nightmare for unit tests. With composition, behaviors are isolated — meaning you can mock or replace them effortlessly. ✅ 3. It aligns better with real domain logic Real-world objects rarely form perfect hierarchies. But they often collaborate, which composition models much better. Takeaway: 👉 Composition helps you build systems that scale without turning into rigid hierarchies you’ll eventually regret. #Java #CleanCode #OOP #SoftwareEngineering #BackendDevelopment #ProgrammingTips
To view or add a comment, sign in
-
-
Day 20: Exploring Java Interfaces with Static, Private, and Public Methods 🧑💻 Today I practiced Java interfaces and learned: Static methods – Called using the interface name (Calculator.add(...)) Private methods – Used inside the interface to support other methods Public methods – Implemented in the class (multiply(...)) Example: int sum = Calculator.add(5, 10); SimpleCalculator calc = new SimpleCalculator(); int product = calc.multiply(5, 10); 💡 Key takeaway: Interfaces in Java can now have static, private, and default methods, making code modular and reusable. ✅ Note: Before Java 1.8, interfaces could only have abstract methods. From Java 1.8, default and static methods were introduced. From Java 1.9, private methods in interfaces became possible to help reuse code inside the interface. 10000 Coders #Java #Interface #OOps #LearningEveryDay #100DaysOfCode #Day20 #CodingJourney
To view or add a comment, sign in
-
-
#DAY56 #100DaysOFCode | Java Full Stack Development #Day56 of my #100DaysOfCode – Java 🔹 PriorityQueue in Java 📘 Introduction: A PriorityQueue in Java is a special type of queue where elements are processed based on their priority rather than the order they are added (FIFO). The element with the highest priority (or lowest value by default) is served first. 🧩 Package: java.util.PriorityQueue ⚙️ Key Features: It does not allow null values. Duplicate elements are allowed. Elements are ordered according to their natural ordering or by a custom comparator. It is not thread-safe. For thread-safe implementation, use PriorityBlockingQueue. Based on a min-heap data structure (the smallest element has the highest priority). 🧠 Syntax: PriorityQueue<Type> pq = new PriorityQueue<>(); 🧰 Example: import java.util.PriorityQueue; public class Main { public static void main(String[] args) { PriorityQueue<Integer> pq = new PriorityQueue<>(); pq.add(25); pq.add(10); pq.add(30); System.out.println("PriorityQueue: " + pq); System.out.println("Head element: " + pq.peek()); // smallest element pq.poll(); // removes head element System.out.println("After removal: " + pq); } } 🖥️ Output: PriorityQueue: [10, 25, 30] Head element: 10 After removal: [25, 30] 💡 Use Cases: Task scheduling (e.g., CPU jobs based on priority) Dijkstra’s shortest path algorithm Huffman coding Event-driven simulations A big thanks to my mentor Gurugubelli Vijaya Kumar Sir and the 10000 Coders for constantly guiding me and helping me build a strong foundation in programming concepts. #Java #Coding #Programming #100DaysOfCode #Java #programming #CodeNewbie #LearnToCode #Developer #Tech #ProgrammingTips #JavaDeveloper #CodeDaily #DataStructures #CodingLife
To view or add a comment, sign in
-
🚀 Inheritance (Java) Inheritance is a mechanism where a new class (subclass or derived class) inherits properties and behaviors from an existing class (superclass or base class). It promotes code reusability and establishes an 'is-a' relationship between classes. Subclasses can override methods from the superclass to provide specialized implementations. Inheritance supports the creation of class hierarchies, making the code more organized and maintainable. It's a powerful tool for modeling real-world relationships and reducing code duplication. #Java #JavaDev #OOP #Backend #professional #career #development
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
So proud to see this journey! 🙌 Proof that when passion meets persistence, great things happen. Keep shining — the best is yet to come! 🌟 > Love this energy! 💫 Your words are a reminder that small steps really do lead to big results. Keep inspiring, always! 🙏 Brahmaiah Talluri