Day 18 – Understanding List vs Set vs Map in Java After exploring different collections individually, today I learned how they compare with each other. 🔹 List (ArrayList) – Stores elements using index, allows duplicates, maintains order 🔹 Set (HashSet) – Stores only unique elements, no duplicates, unordered 🔹 Map (HashMap) – Stores data in key–value pairs, keys must be unique 💡 Key takeaway: Choosing the right data structure is important for writing efficient and clean code. This comparison helped me clearly understand when to use each collection type. #Java #Collections #ArrayList #HashSet #HashMap #Programming #LearningInPublic #Day18
Java List vs Set vs Map Collections
More Relevant Posts
-
Day 43-What I Learned In a Day(JAVA) Today I worked on String concepts in Java and practiced some interesting problems. What I learned: Creating and using strings in Java Converting a number into an array using strings Handling characters using charAt() Problems I practiced: ✅ Created and manipulated strings ✅ Converted number -array using string ✅ Moved zeros to the end of an array These problems helped me understand how strings and arrays work together and improved my problem-solving skills. Learning step by step and getting better every day! Practiced 👇 #Java #CodingPractice #LearningJourney #Programming #100DaysOfCode
To view or add a comment, sign in
-
📘 Day 41 of My Learning Journey Today, I explored two important methods from the java.lang package: getClass() and toString(). 🔹 getClass() Method This method is used to get the runtime class of an object. It helps in understanding the exact class an object belongs to during execution. 🔹 toString() Method This method converts an object into a readable string format. By default, it returns the class name along with the hashcode, but it can be overridden to display meaningful information. 💡 Learning these methods helped me understand how Java represents objects internally and how we can customize their output for better readability. Step by step, improving my understanding of core Java concepts! 🚀 #Java #LearningJourney #Day41 #OOP #Programming #TechSkills
To view or add a comment, sign in
-
-
Day 55-What I Learned In a Day (JAVA) Today, I learned how to create and use constructors in Java. 🔹 A constructor is a special method used to initialize an object when it is created. 🔹 Constructors are non-static by default, meaning they work with objects and help assign values to instance variables. 🔹 They are automatically executed when an object is created, making object initialization simple and efficient. 🔹 This reduces the need for setting values manually after object creation. Understanding constructors helped me see how Java initializes objects in a structured and efficient way. #Java #OOP #Constructors #LearningJourney #Programming #TechSkills
To view or add a comment, sign in
-
Day 4: Constructors After understanding classes, objects, encapsulation, and access modifiers, the next step is learning how objects get their initial values. That is where constructors come in. A constructor is used to initialize an object when it is created. In Java, it has the same name as the class, has no return type, and runs automatically when the object is created. Simple idea, but very important, because it helps us create objects in a cleaner and more intentional way. #Java #OOP #Programming #SoftwareEngineering #ComputerScience #koofkee
To view or add a comment, sign in
-
-
Day 47 – Understanding Encapsulation in Java ☕ Today I revised the concept of Encapsulation and its importance in object-oriented programming. Topics covered: 🔹 What is encapsulation and why it is important 🔹 Providing security with the help of private variables 🔹 Role of getters and setters 🔹 Understanding the shadowing problem 🔹 How to overcome shadowing using the this keyword Learning how encapsulation helps in data hiding and secure access to variables gave me better clarity on writing maintainable and structured code. Strengthening my core OOP concepts step by step 🚀 #Day47 #JavaJourney #OOP #Encapsulation #CoreJava #Consistency
To view or add a comment, sign in
-
-
💡 Question for Developers In Java, we often use private fields with getters and setters instead of making fields public. But here’s my question: 👉 If we can directly access public fields, why do we still prefer private fields with getters/setters? Is it only about encapsulation, or are there deeper practical reasons in real-world projects? I’d love to hear your thoughts and experiences in the comments 👇 #Java #OOP #Programming #SoftwareDevelopment #Learning
To view or add a comment, sign in
-
Day 5: Inheritance As programs grow, many classes start sharing similar properties or behavior. That is where inheritance becomes useful. Inheritance allows one class to take the properties and behavior of another class. In Java, we use `extends` to create that relationship. This helps reduce repetition and makes code easier to organize when classes are related. #Java #OOP #Programming #SoftwareEngineering #ComputerScience #koofkee
To view or add a comment, sign in
-
-
📘 Revised Logic Building in Java with @LetsUpgrade (Day 2) Attended Day 2 of the Java Bootcamp, which focused on strengthening problem-solving and logic building skills. 🔹 Topics revised: • Conditional Statements (if, else, else-if) • Loops (for, while) • Arrays • Strings and basic functions 💻 Practice: Worked on basic problems and received homework to improve coding skills Revisiting these concepts is really helping me improve my logic and confidence in Java. Looking forward to learning more! #LetsUpgrade #Java #Programming #Coding #JavaBasics #LogicBuilding #LearningJourney #DeveloperJourney
To view or add a comment, sign in
-
-
📅 Day 45 of My Learning Journey Today, I explored two important concepts in Java: String Class and StringBuffer. 🔹 String Class Strings are immutable, meaning once an object is created, it cannot be changed. Any modification results in the creation of a new object. Widely used for safe and secure data handling. 🔹 StringBuffer StringBuffer is mutable, meaning it allows changes without creating new objects. It is thread-safe (synchronized), making it suitable for multi-threaded environments. Provides methods like append(), insert(), and reverse() for efficient string manipulation. 💡 Key Takeaway: Use String when data should remain constant, and StringBuffer when frequent modifications are required, especially in multi-threaded applications. 📌 Understanding the difference between immutability and mutability helps in writing optimized and efficient Java programs! #Day45 #Java #StringClass #StringBuffer #Programming #LearningJourney #TechSkills
To view or add a comment, sign in
-
-
Day 38 of Learning Java Today, I explored how a class executes inside the JVM (Java Virtual Machine). Understanding this lifecycle really helped me see what happens behind the scenes when we run a Java program. 🔹 Class Loading • The JVM loads the class into memory • It brings the ".class" file into the system 🔹 Linking Phase • Verification → Checks bytecode for errors • Preparation → Allocates memory for static variables (default values like 0) • Resolution → Replaces symbolic references with actual memory references 🔹 Initialization • Static variables get their actual assigned values • Static blocks are executed 🔹 Execution • Methods start running and the program logic is executed 🔹 Destruction • Objects are destroyed and memory is cleaned up by the Garbage Collector Static variables first get default values during preparation, and later their actual values during initialization. Thanks to my mentor Ashim Prem Mahto for the clear explanations and for always clearing my doubts. #Java #JVM #LearningJourney #Programming #SoftwareDevelopment #BackendDevelopment #CodingLife #JavaDeveloper #TechLearning #StudentLife
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