🔥 “Today I dived deep into Java Streams — and wow, they simplify logic beautifully!” I explored how to handle multiple conditions using Streams — especially for problems like finding numbers “between two sets”, where I used methods like 👉 allMatch() 👉 filter() 👉 and reduce() from Stream. ➡️ 10 questions today I solved 1. Find the second-highest marks among students. 2. Find the top 3 students based on marks. 3. Find the names of students who belong to “CSE” and scored more than 80. 4. Display the student with the longest name. 5. Find total marks of all students using reduce(). 6. Convert the student list into a Map → key as name, value as marks. 7. Get list of students sorted by marks, then by name (multi-level sort). 8. Find students whose marks are between 50 and 80. 9. Get only unique branches from the student list. 10. Display the branch with the highest average marks. These help write clean, readable, and efficient code instead of nested loops. Here’s a small takeaway from today’s practice: “Streams make your logic more expressive and help you think functionally!” Excited to explore more real-time problems using Streams tomorrow! 💪 #Java #StreamAPI #AdvancedJava #CodingJourney #LearningEveryday #ProblemSolving
"Mastered Java Streams: Simplified Logic for Problem Solving"
More Relevant Posts
-
💻 LeetCode 50 Days Challenge — Day 8: Median of Two Sorted Arrays Day 8 of my #LeetCode50DaysChallenge ✅ Today’s problem was about finding the median of two sorted arrays — Median of Two Sorted Arrays ✨ 🧩 Problem: Given two sorted arrays nums1 and nums2, return the median of the two sorted arrays. The challenge was to merge them efficiently and then determine the middle value(s). 💡 Approach: I used Java 8 Streams to merge both arrays in a single line using IntStream.concat(), followed by Arrays.sort() to sort the combined array. Finally, I calculated the median by checking if the array length is even or odd. ⏱️ Time Complexity: O((m + n) log (m + n)) (due to sorting) 📊 Example: Input: nums1 = [1, 2], nums2 = [3, 4] Output: 2.5 Each day, I’m getting more comfortable with cleaner and modern Java techniques like Streams — small steps toward writing concise and efficient code 🚀 #LeetCode #CodingChallenge #Day8 #ProblemSolving #Java #SoftwareDevelopment #Consistency #50DaysOfCode
To view or add a comment, sign in
-
-
If you’re learning #Java, you’ve probably seen the keywords #static and wondered — what’s the difference between static and non-static methods? 🤔 Let’s break it down 👇 🧩 Static Methods - Belong to the #class, not to any specific object. - Can be called without creating an #object. - Commonly used for utility or helper functions. ⚙️ Non-Static Methods -Belong to objects created from the class. -Need an instance to be called. -Can access both static and non-static members of the class. 🔑 Key takeaway: -Use 'static' when behavior doesn’t depend on 'object' data. Use 'non-static' when the method works with 'instance' variables. 💬 What’s one thing about static that confused you when you first started learning Java? Let’s discuss in the comments 👇 #Java #LearnJava #CodingForBeginners #SoftwareDevelopment #ProgrammingTips #JavaDeveloper #CodeNewbie #TechEducation
To view or add a comment, sign in
-
-
🚀 Day 29 of 100 Days of LeetCode 📘 Problem: Combination Sum 💻 Language: Java ✅ Status: Accepted — Runtime ⚡ 2 ms (Beats 86%) Today’s problem was all about backtracking — exploring all possible combinations to reach a target sum. It’s a perfect blend of recursion, decision-making, and pruning unnecessary paths 🧠 ✨ Key Learnings: Backtracking is like exploring a maze — try, backtrack, and try again until you find the exit 🌀 Each recursive call represents a “choice point” — include or skip the element Clean recursion with controlled base cases leads to clarity and precision This problem reminded me how persistence works in both code and life: 💬 “Sometimes, the path to the solution is not straightforward — you just need to keep exploring.” #Day29 #100DaysOfCode #LeetCode #Java #Backtracking #Recursion #DSA #ProblemSolving #CodingJourney #SoftwareDevelopment #KeepLearning #CodeEveryday
To view or add a comment, sign in
-
-
✨ Day 74 of #100DaysOfCode Today, I solved LeetCode 22. Generate Parentheses using Backtracking in Java 🧠💻 📝 Problem Summary: Given n pairs of parentheses, generate all combinations of well-formed parentheses. ✅ Example: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] 💡 Key Idea: Use backtracking to build all valid strings. Keep track of the number of opening and closing brackets. Add '(' if open < n. Add ')' if close < open. When the string reaches length 2 * n, it's a valid combination. 🚀 Learning: Backtracking is a powerful technique for exploring all valid combinations. Keeping proper state (open, close) helps prune invalid paths early. #100DaysOfCode #LeetCode #DSA #Java #ProblemSolving #Backtracking #CodingChallenge #SowmiyaCodes #PlacementPrep
To view or add a comment, sign in
-
-
💻 Day 13 of My Java Online Class – Exploring Java 8 Features & Lambda Expressions! Today, I learned and practiced some of the most powerful features introduced in Java 8 — Stream API, Optional, and Lambda Expressions. 🚀 🧩 Question 1: Implemented a program demonstrating: ✅ Use of Stream API for filtering and sorting a list of integers. ✅ Handling null values safely using Optional. ✅ Iterating over collections using the forEach() method. This helped me understand how Java 8 makes code more concise, readable, and efficient. 🧩 Question 2: Explored Lambda Expressions for: ✅ Sorting a list of strings in descending order. ✅ Filtering numbers greater than a given value using the Stream API. This exercise showed how lambda functions simplify code by removing the need for anonymous classes. 📘 Key Learnings: Efficient data processing using Streams. Safe handling of null values with Optional. Writing cleaner and shorter code with Lambda Expressions. Enhanced readability and performance with Java 8 features. Cybernaut EdTech #60dayscodechallenges #TechTrio #CybernautEdtech #Java #LambdaExpressions #StreamAPI #OptionalClass #JavaLearning #OnlineClass #Day13 #ProgrammingJourney #LearnJava #Coding
To view or add a comment, sign in
-
-
🚀 Week 4 of My Java Learning Journey! This week, I explored Methods and Arrays — the building blocks that make Java programs modular and data-driven! 🧠 It was exciting to understand how methods simplify code and how arrays efficiently store and manipulate data. 💻 🧩 Key Learnings: Methods: Definition, Parameters, Scope Static methods and why they’re important Calling and Returning Methods Arrays: One-Dimensional & Two-Dimensional Array operations: Sorting and Searching 💻 Practice Programs: Array operations: Find Max, Min, Reverse, Sum Menu-based Array Application Method-based problem solving and modular programs 📝 Extra Skill: Improved code organization and reusability using methods 🔗 Check out my Week 4 GitHub repo: https://lnkd.in/gPAqMUPf Excited for Week 5, where I’ll dive into String Concepts — taking Java to the next level! 🚀 #Java #Programming #CodingJourney #Git #GitHub #100DaysOfCode #Learning #Backend
To view or add a comment, sign in
-
🚀 Week 5 of My Java Learning Journey! This week, I explored String Concepts in Java — one of the most powerful and commonly used data types! 🔤 It was exciting to understand how Strings work internally and how many different operations can be performed using built-in methods. 💻 🧩 Key Learnings: What is String & how it is stored in memory String vs StringBuilder vs StringBuffer String methods (length, charAt, substring, indexOf, equals, compareTo, replace, trim, split, etc.) Immutable vs Mutable strings String concatenation & performance 💻 Practice Programs: Reverse a string Count vowels & consonants Check palindrome string Compare two strings Word / character frequency Splitting sentences into words 📝 Extra Skill: Explored performance difference between String vs StringBuilder using loop concatenation 🔗 Check out my Week 5 GitHub repo: https://lnkd.in/giiR_G86 Excited for Week 6, where I’ll dive into Object-Oriented Programming (OOPs) Concepts — taking Java to the next level! 🚀 #Java #Programming #CodingJourney #Git #GitHub #100DaysOfCode #Learning #Backend #Strings
To view or add a comment, sign in
-
💡 Why char Occupies 2 Bytes in Java but 1 Byte in C💡 Many learners get confused about why char takes 2 bytes in Java while it takes only 1 byte in C. Let’s understand it simply ⚙️ In C (1 Byte) 🔸C is a low-level, hardware-oriented language. 🔸The size of char in C is defined as 1 byte, which is typically 8 bits on modern systems. 🔸C was created when systems mainly used ASCII, so one byte (0–255) was enough to represent characters. The exact number of bits per char may vary depending on the system (for example, 8, 9, or even 16 in rare architectures). ☕ In Java (2 Bytes) 🔸Java was designed with Unicode (UTF-16) support to handle multiple languages and symbols worldwide 🌍. 🔸Hence, every char in Java occupies 16 bits (2 bytes) — enough to represent most Unicode characters. 🔸Java ensures portability — meaning a character uses the same memory size on every platform. ✨ In Short 🔸Java → 2 Bytes for global Unicode 🌏 🔸C → 1 Byte for hardware efficiency ⚙️ 🔸Java focuses on portability and internationalization, 🔸C focuses on speed and direct hardware control 💻 📘 Conclusion Both languages made the right choice for their time and purpose. 🔸Java wanted “write once, run anywhere” 🌐 🔸C wanted “run fast, close to the machine” ⚡ #Java #C #Programming #Coding #Unicode #JVM #LearnToCode #CodeSmart #ComputerScience #Codegnan Thanks to my mentor Anand Kumar Buddarapu Saketh Kallepu Uppugundla Sairam
To view or add a comment, sign in
-
-
Day 28 - of My Java Learning Series 🧠 From Confusion to Clarity: My Interface Revelation Back when I first learned about Java interfaces, I thought I had them figured out: “Interfaces = 100% abstraction. No method bodies allowed.” Simple, right? But today, that belief got a major upgrade. While diving deeper into modern Java, I discovered that interfaces aren’t just abstract contracts anymore — they’ve evolved into something far more powerful. And honestly, it felt like unlocking a hidden level in the language I thought I knew. Here’s how the story unfolded 👇 🔹 Default Methods I was surprised to learn that interfaces can now have method bodies using the default keyword. Why? So we can add new behavior without breaking existing implementations. Think of it as giving interfaces a gentle way to evolve. 🔹 Static Methods These live inside the interface but don’t belong to any instance. Perfect for utility logic — and yes, you call them using the interface name itself. It’s like giving interfaces their own toolbox. 🔹 Private Methods (Java 9+) This one really clicked for me. Private methods help reduce code duplication inside interfaces — especially when multiple default or static methods share logic. They’re invisible to implementing classes, but super useful behind the scenes. 🔹 Private Static Methods (Java 9+) Same idea, but for static logic. They keep things clean, modular, and reusable — all within the interface itself. ✨ What I Took Away Interfaces in Java are no longer just about abstraction. They’re about evolution without disruption, modularity without mess, and power without complexity. I used to think interfaces were rigid. Now I see them as flexible blueprints — capable of growing with our code. #Java #Interfaces #LearningJourney #OOPs #Programming #TechLearning #Java8 #Java9
To view or add a comment, sign in
-
-
𝙍𝙚𝙢𝙚𝙢𝙗𝙚𝙧 𝙞𝙣 𝙥𝙧𝙞𝙢𝙖𝙧𝙮 𝙨𝙘𝙝𝙤𝙤𝙡 𝙬𝙝𝙚𝙣 𝙩𝙝𝙚 𝙩𝙚𝙖𝙘𝙝𝙚𝙧 𝙖𝙨𝙠𝙚𝙙, "𝙒𝙝𝙖𝙩 𝙞𝙨 2 – 3?" It felt impossible. I got that exact same feeling when I first learned about Java Reflection. We were all taught the same sacred rule: encapsulation. private means private. ...Well, almost. Java 𝗥𝗲𝗳𝗹𝗲𝗰𝘁𝗶𝗼𝗻 is the VIP pass to the JVM's backstage. It's a powerful API that lets you inspect and manipulate classes, fields, and methods at runtime. 𝗬𝗲𝘀, 𝗲𝘃𝗲𝗻 𝗽𝗿𝗶𝘃𝗮𝘁𝗲 𝗳𝗶𝗲𝗹𝗱𝘀. One single line of code 𝗳𝗶𝗲𝗹𝗱.𝘀𝗲𝘁𝗔𝗰𝗰𝗲𝘀𝘀𝗶𝗯𝗹𝗲(𝘁𝗿𝘂𝗲) and the encapsulation barrier is 𝗴𝗼𝗻𝗲. This isn't a gadget for everyday code. This is the "magic" that runs our most critical tools: 𝗙𝗿𝗮𝗺𝗲𝘄𝗼𝗿𝗸𝘀: How does Spring manage to inject your @Autowired dependencies? Through 𝗥𝗲𝗳𝗹𝗲𝗰𝘁𝗶𝗼𝗻. 𝗝𝗣𝗔/𝗛𝗶𝗯𝗲𝗿𝗻𝗮𝘁𝗲: How does data from the database end up in your private fields? 𝗥𝗲𝗳𝗹𝗲𝗰𝘁𝗶𝗼𝗻. 𝗦𝗲𝗿𝗶𝗮𝗹𝗶𝘇𝗮𝘁𝗶𝗼𝗻: How do Jackson & Gson turn a JSON string into a Java object? You guessed it... 𝗥𝗲𝗳𝗹𝗲𝗰𝘁𝗶𝗼𝗻. It's slower, it can open up security holes, and it breaks the very encapsulation we work so hard to respect. But you can't truly understand the modern Java ecosystem without understanding this powerful mechanism at the heart of it all. #Java #JavaDevelopment #SoftwareEngineering #SpringBoot #Programming #Tech #OOP #Reflection
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