🌟 Day 48 of #100DaysOfCode with Codegnan 🌟 The journey through the Java Collections Framework continued today! We explored more of the List interface and then ventured into the world of Set. 🧑💻 Java Programming Journey 🧑💻 LinkedList: The Dynamic List ⛓️ First, we learned about LinkedList. Unlike ArrayList, which is backed by an array, a LinkedList stores elements as nodes, each pointing to the next (and previous). This makes it incredibly fast for adding and removing elements from the middle of the list. Set Interface: No Duplicates Allowed! ⛔ Next, we moved to the Set interface, a collection that, by definition, cannot contain duplicate elements. This is its defining feature! We explored its three main implementations, and the difference is all about order: HashSet: Order: Unordered. It uses hashing for storage, so the order is unpredictable. Speed: The fastest for adding and checking ( contains()) elements, thanks to hashing. Duplicates: Not allowed. LinkedHashSet: Order: Maintains insertion order. Elements are stored in the order they were added. Speed: Nearly as fast as HashSet. Duplicates: Not allowed. TreeSet: Order: Sorted order. Elements are automatically sorted in their natural order (or by a custom comparator). Speed: Slower, as it needs to maintain the sorted order (uses a tree structure). Duplicates: Not allowed. Practice and Application 💡 We practiced the specific methods for LinkedList and then focused on HashSet, adding elements and observing how it automatically handles duplicates. Key Takeaway: The collection you choose is critical. Need a resizable array? ArrayList. Need fast insertions/deletions? LinkedList. Need to store unique items? Set. Need them unsorted and fast? HashSet. Need them in insertion order? LinkedHashSet. Need them sorted? TreeSet. Understanding these differences is key to writing efficient code! 🚀 #100DaysOfCode #Java #CollectionsFramework #DataStructures #LinkedList #Set #HashSet #LinkedHashSet #TreeSet #Codegnan #ProblemSolving Mentors: Levaku Lavanya Ma'am, Saketh Kallepu Sir, Uppugundla Sairam Sir
Exploring Java Collections Framework with Codegnan
More Relevant Posts
-
🌟 Day 45 of #100DaysOfCode with Codegnan 🌟 Today, we explored a fascinating and powerful feature of Java I/O: Serialization and Deserialization. This is the magic that allows us to save the state of an entire object and bring it back to life later! 🧑💻 Java Programming Journey 🧑💻 What We Learned Serialization 🧊: This is the process of converting a Java object into a byte stream. Once in this form, the object can be easily saved to a file, stored in a database, or sent over a network. It's like freezing an object in time, capturing all its data. To allow this, a class must implement the Serializable marker interface. Deserialization 🔥: This is the exact opposite. It's the process of reading a byte stream and reconstructing the original object from it, complete with all its saved data. It's like thawing the object, restoring it to its previous state. The transient Keyword 🤫 What if you have data you don't want to save? We learned about the transient keyword for this. When you mark a variable as transient, you are telling the serialization process to skip this field. It will not be saved to the byte stream. This is perfect for: Sensitive data (like passwords). Temporary values that can be recalculated. Fields that aren't serializable themselves. Practice and Application 💡 We practiced by creating a class, making it Serializable, saving an object of that class to a file, and then reading it back via deserialization. We also experimented with the transient keyword to see how it excluded data from the process. Key Takeaway: Serialization is a game-changer for data persistence. It's not just about saving text; it's about saving entire, complex objects, making it incredibly powerful for saving application state, caching, and more. Another powerful Java concept in the bag! 🚀 #100DaysOfCode #Java #FileHandling #JavaIO #Serialization #Deserialization #Transient #Codegnan #ProblemSolving Mentors: Levaku Lavanya Ma'am Saketh Kallepu Sir Uppugundla Sairam Sir
To view or add a comment, sign in
-
-
🌟 Day 47 of #100DaysOfCode with Codegnan 🌟 Today marked the beginning of a huge new topic that's at the heart of Java development: the Collections Framework! This is a massive step up from basic arrays for managing groups of objects. 🧑💻 Java Programming Journey 🧑💻 Why Move Beyond Arrays? We started by discussing the major disadvantages of arrays. The biggest problem is that arrays have a fixed size. Once you create an array, you can't change its capacity, which is incredibly inefficient if you don't know how much data you'll need. The Collections Framework 📦 This is Java's built-in, high-performance architecture for storing and manipulating groups of objects. It's a ready-made set of data structures that are dynamic, efficient, and easy to use. Framework Hierarchy: We explored the "family tree" of collections, seeing how core interfaces like List, Set, and Queue provide a common blueprint for all the different data structures. Spotlight on ArrayList: Our first practical dive was into the ArrayList class. It's the go-to, resizable array implementation! It gives us the power of an array but with dynamic sizing. We practiced its common methods: ✔️ add(element) - To add items. ✔️ get(index) - To retrieve items. ✔️ remove(index) - To delete items. ✔️ size() - To check the current number of elements. Key Takeaway 💡 While arrays are simple, the Collections Framework is essential for any serious Java application. ArrayList is the perfect first step, offering the flexibility to grow and shrink as needed—a power that basic arrays just can't provide. Excited to explore the rest of this framework! 🚀 #100DaysOfCode #Java #CollectionsFramework #DataStructures #ArrayList #JavaCollections #Codegnan #ProblemSolving Mentors: Levaku Lavanya Ma'am, Saketh Kallepu Sir, Uppugundla Sairam Sir.
To view or add a comment, sign in
-
-
🌟 Day 47 of #100DaysOfCode with Codegnan 🌟 Today marked the beginning of a huge new topic that's at the heart of Java development: the Collections Framework! This is a massive step up from basic arrays for managing groups of objects. 🧑💻 Java Programming Journey 🧑💻 Why Move Beyond Arrays? We started by discussing the major disadvantages of arrays. The biggest problem is that arrays have a fixed size. Once you create an array, you can't change its capacity, which is incredibly inefficient if you don't know how much data you'll need. The Collections Framework 📦 This is Java's built-in, high-performance architecture for storing and manipulating groups of objects. It's a ready-made set of data structures that are dynamic, efficient, and easy to use. Framework Hierarchy: We explored the "family tree" of collections, seeing how core interfaces like List, Set, and Queue provide a common blueprint for all the different data structures. Spotlight on ArrayList: Our first practical dive was into the ArrayList class. It's the go-to, resizable array implementation! It gives us the power of an array but with dynamic sizing. We practiced its common methods: ✔️ add(element) - To add items. ✔️ get(index) - To retrieve items. ✔️ remove(index) - To delete items. ✔️ size() - To check the current number of elements. Key Takeaway 💡 While arrays are simple, the Collections Framework is essential for any serious Java application. ArrayList is the perfect first step, offering the flexibility to grow and shrink as needed—a power that basic arrays just can't provide. Excited to explore the rest of this framework! 🚀 #100DaysOfCode #Java #CollectionsFramework #DataStructures #ArrayList #JavaCollections #Codegnan #ProblemSolving Mentors: Levaku Lavanya Ma'am, Saketh Kallepu Sir, Uppugundla Sairam Sir.
To view or add a comment, sign in
-
🌟 Day 47 of #100DaysOfCode with Codegnan 🌟 Today marked the beginning of a huge new topic that's at the heart of Java development: the Collections Framework! This is a massive step up from basic arrays for managing groups of objects. 🧑💻 Java Programming Journey 🧑💻 Why Move Beyond Arrays? We started by discussing the major disadvantages of arrays. The biggest problem is that arrays have a fixed size. Once you create an array, you can't change its capacity, which is incredibly inefficient if you don't know how much data you'll need. The Collections Framework 📦 This is Java's built-in, high-performance architecture for storing and manipulating groups of objects. It's a ready-made set of data structures that are dynamic, efficient, and easy to use. Framework Hierarchy: We explored the "family tree" of collections, seeing how core interfaces like List, Set, and Queue provide a common blueprint for all the different data structures. Spotlight on ArrayList: Our first practical dive was into the ArrayList class. It's the go-to, resizable array implementation! It gives us the power of an array but with dynamic sizing. We practiced its common methods: ✔️ add(element) - To add items. ✔️ get(index) - To retrieve items. ✔️ remove(index) - To delete items. ✔️ size() - To check the current number of elements. Key Takeaway 💡 While arrays are simple, the Collections Framework is essential for any serious Java application. ArrayList is the perfect first step, offering the flexibility to grow and shrink as needed—a power that basic arrays just can't provide. Excited to explore the rest of this framework! 🚀 #100DaysOfCode #Java #CollectionsFramework #DataStructures #ArrayList #JavaCollections #Codegnan #ProblemSolving Mentors: Levaku Lavanya Mam, Saketh Kallepu Sir, Uppugundla Sairam Sir.
To view or add a comment, sign in
-
-
🤯 Day 32 of My Java Learning Journey 🏹 💡 Ever wondered why your Java code runs slow when you keep joining strings in a loop? That’s where StringBuilder becomes your superhero! In Java, String and StringBuilder may look similar but behave very differently. A String is immutable once created, it can’t be changed. So every time you modify it, a new object is created in memory. 😬 On the other hand, StringBuilder is mutable meaning it changes the existing value without creating a new one! That’s why it’s perfect for tasks like concatenating text in loops or building dynamic messages. 🧩 Last week, I tried concatenating 1000 names using String… my program lagged 😅. Switched to StringBuilder, and boom it finished instantly! Lesson learned: choose performance wisely! 💪 Keep learning, keep optimizing small code changes can make a big difference in your growth as a developer! #Java #AccessModifiers #JavaLearning #CodingJourney #BackendDevelopment #JavaDeveloper #OOP #CodeSecurity #LearnInPublic #100DaysOfCode #TechCareer #ProgrammingTips #SoftwareEngineering #DevelopersJourney #CodeBetter #JavaProgramming #CleanCode #SpringBoot #BackendEngineer #Maang #Consistency #Motivation #Hustle #Google #CarrierGoal
To view or add a comment, sign in
-
-
🌟 Day 55/180 – Java Full Stack Development 🌟 📘 Topic: Why Multiple Inheritance is Not Possible in Java 🔹 1️⃣ What I Learned Today: I learned that multiple inheritance is not possible in Java using classes because it causes a problem called the Diamond Problem. 🔹 2️⃣ What is Multiple Inheritance? It means a child class inherits from two parent classes at the same time. Example: class A {} class B {} class C extends A, B {} // ❌ Not allowed in Java 🔹 3️⃣ The Diamond Problem (The Real Reason): Imagine this situation 👇 Class A has a method show(). Classes B and C both extend A and override show(). Now Class D tries to extend both B and C. When we call show() from D, Java gets confused — 👉 “Should I call show() from B or from C?” This ambiguity is called the Diamond Problem 💎 🔹 4️⃣ Why Java Avoids It: To keep the language simple, clear, and unambiguous, Java designers disallowed multiple inheritance using classes. 🔹 5️⃣ Then How to Achieve It? ✅ Using Interfaces! Interfaces only have method declarations (no implementation), so even if multiple interfaces have the same method, the child class defines its own version — no confusion! 😎 Example: interface A { void show(); } interface B { void show(); } class C implements A, B { public void show() { System.out.println("Hello from C!"); } } 💡 Key Takeaways: Multiple inheritance ❌ not possible using classes. Diamond Problem 💎 causes ambiguity. Interfaces ✅ solve the problem. Java keeps it clean, simple, and safe. #Day55Of180 #JavaFullStack #JavaLearning #OOPsConcepts #InheritanceInJava #DiamondProblem #JavaProgrammer #LearnJava #JavaDeveloper #JavaCode #CodingJourney #FullStackDeveloper #CodeNewbie #ProgrammersLife #100DaysOfCode #TechLearning #DeveloperCommunity #WomenInTech #CodingMotivation #SoftwareEngineer #CodeDaily #BackendDeveloper #ProgrammingLife #CodeWithMe #LearnToCode #CodingIsFun #TechJourney #StudyWithMe #ITCareer #JavaConcepts
To view or add a comment, sign in
-
-
🚀 Day 56/180 — Java Full Stack Learning Journey Today, I learned two important Java concepts 👇 🔹 Method Overloading 🔹 Varargs (Variable Arguments) 💡 Method Overloading — Same Name, Different Parameters 🔸 It means using the same method name with different parameter lists (data types or count). 🔸 The purpose of the method remains the same — only the inputs change. 🔸 This makes the code clean, organized, and easy to understand. 🔸 It avoids creating multiple confusing method names for the same functionality. 🔸 The compiler decides which version to call, based on the arguments passed. 🧠 Daily Life Example: If a person is a driver, it doesn’t matter whether he drives a car, bike, or cycle — we still call him a driver 🚗🏍️🚴♂️ Here, the vehicle (object) changes, but the work (driving) remains the same. Similarly, in Java, the method name stays the same, even though the parameters differ! ⚙️ Varargs (Variable Arguments) 🔸 Varargs allow a method to accept a variable number of arguments. 🔸 You don’t need to overload the same method multiple times. 🔸 Syntax: void methodName(int... values) 🔸 Internally, Java treats varargs as an array. 🧩 Example: void display(int... numbers) { for(int n : numbers) System.out.print(n + " "); } ✅ display(1); ✅ display(1, 2, 3); ✅ display(5, 10, 15, 20); —all work perfectly with a single method! Every day, I realize that Java is not just coding — it’s logical and relatable to real life! 💻✨ #Day56 #JavaFullStack #JavaDeveloper #MethodOverloading #Varargs #OOPsConcepts #ProgrammingInJava #LearningInPublic #CodingJourney #100DaysOfCode #DailyLearning #CodeEveryday #TechLearning #JavaProgramming #DeveloperJourney
To view or add a comment, sign in
-
#DAY54 of Learning Java Fullstack... Today Let's learn about the inner classes.... What are the inner classes? 💡 Inner Classes in Java ★ An Inner Class in Java is a class defined inside another class. ★ It helps in grouping classes logically and improving encapsulation. ★Inner classes can access the private members of the outer class. 🔹 Types of Inner Classes in Java There are 4 main types of inner classes: ➤ Non-static Inner Class (Member Inner Class) Defined inside another class but outside any method and without the static keyword. ➤ Static Nested Class Declared inside another class using the static keyword. It does not require an object of the outer class to be created. ➤ Local Inner Class Declared inside a method, constructor, or block. It is local to that block and cannot be accessed outside it. ➤ Anonymous Inner Class A class without a name that is used to instantiate objects with certain modifications. #Java #InnerClasses #CoreJava #JavaProgramming #Coding #JavaDeveloper #ProgrammingConcept #LearnJava #CodeWithJava #TechLearning 10000 Coders Gurugubelli Vijaya Kumar
To view or add a comment, sign in
-
#DAY59 #100DaysOFCode | Java Full Stack Development #Day59 of my #100DaysOfCode – Java 📘 Cursor in Java A Cursor in Java is used to traverse elements of a collection one by one. It provides a way to access, remove, or modify elements during iteration. Cursors are mainly used in the Collection Framework for iterating over lists, sets, and legacy classes. 🔹 Types of Cursors in Java Enumeration Used with legacy classes like Vector and Hashtable. Can only move forward. Cannot add or remove elements. Methods: hasMoreElements() – checks for next element nextElement() – returns next element Iterator Works with all collection classes. Can move only forward. Allows removal of elements during iteration. Methods: hasNext() next() remove() ListIterator Used only with List classes (ArrayList, LinkedList). Can move both forward and backward. Allows add, remove, and modify operations. Methods: hasNext(), next() hasPrevious(), previous() add(), remove(), set() 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
-
-
#DAY68 #100DaysOFCode | Java Full Stack Development #Day68 of my #100DaysOfCode – Java 📘 Cursor in Java A Cursor in Java is used to traverse elements of a collection one by one. It provides a way to access, remove, or modify elements during iteration. Cursors are mainly used in the Collection Framework for iterating over lists, sets, and legacy classes. 🔹 Types of Cursors in Java Enumeration Used with legacy classes like Vector and Hashtable. Can only move forward. Cannot add or remove elements. Methods: hasMoreElements() – checks for next element nextElement() – returns next element Iterator Works with all collection classes. Can move only forward. Allows removal of elements during iteration. Methods: hasNext() next() remove() ListIterator Used only with List classes (ArrayList, LinkedList). Can move both forward and backward. Allows add, remove, and modify operations. Methods: hasNext(), next() hasPrevious(), previous() add(), remove(), set() 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
-
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