Saturday, October 28, 2023

Java 8 Stream.filter() example Example with Null and Empty String

The filter() is a method on Stream class, which accepts a Predicate (a functional interface with a method which return boolean) and returns a stream consisting of the elements of this stream that match the given predicate. For example, if stream is obtained from a list containing "SONY", "APPLE" and "GOOGLE" and predicate is elements with length greater than 4, then filter will return another stream containing only APPLE and GOOGLE, leaving SONY out because its length is not greater than 4. Java 8 provides advanced filtering capability using lambdas and predicates. 

Saturday, October 21, 2023

10 Example of Comparator and Sorting in Java 8

The Comparator class is used to provide code or logic for comparing objects in Java, while sorting a list of objects or a collection of objects. It's close cousin of Comparable which provides natural order sorting e.g. ascending and descending orders for numbers like int, short, long or float, and lexicographic order for String i.e. the order on which words are arranged in dictionaries. The Comparators are used while sorting arrays, lists and collections. You pass logic to compare objects and sorting methods like Collections.sort() use that logic to compare elements until they are arranged in sorted order. 

Monday, October 16, 2023

Top 14 Courses to Learn System Design and Software Architecture in 2024 - Best of Lot

Software design or System design is one of the tricky concepts to master. You can quickly learn a programming language like Java or Python, but creating software using that programming language is a totally different thing. That's where software design and coding skills come to the rescue. It's actually an art to structure your program, design your modules, specify boundaries and interactions with other parts of the system so that they are easier to read, maintain, and flexible to change. It's one of the most essential skills for a software developer but often gets ignored. If you look for an online course to learn Software design and architecture, you won't find many, forget about good ones.

Tuesday, October 10, 2023

How to Create and Extract a ZIP File in Java? Unzip Example Tutorial

In Java, you can use ZipFile class to unzip a .jar and .zip file in Java. These classes are defined in and java.util.zip package. Unfortunately there is no ZipUtil class, which provides straightforward methods to decompress zip files, but thankfully there are enough tools available in JDK to write your own method to extract zip file in Java. There are mainly two steps to unzip a zip file in Java, first, create all directories inside of the zip file, because zip archive flattens all directory and second create all file which are inside .zip file. Sinze files in .zip file is not in specific order, you need to iterate twice to perform these steps individually.

Monday, October 9, 2023

How to implement Level Order Traversal of Binary Tree in Java? Example Tutorial

Hello guys, if you have worked in Java then you know that binary tree is one of the essential data structure and quite an important one for programmers, I even mentioned that on my 10 essential data structures for programmers articles.  Binary tree related question are also quite common on coding interviews and we are going to see one today but before that, let's revise what is binary tree? Binary trees are hierarchical data structures composed of nodes, each having at most two children: a left child and a right child. Traversing a binary tree in level order involves visiting nodes level by level, starting from the root. 

Sunday, October 8, 2023

How to make Immutable class in Java? Mutable vs Immutable Objects

How I make immutable objects in Java? I've always thought that all objects are immutable, because if you change the content of an String example, it will always create you an new String object and point to that. However later I found that String is a special class and its specially designed as an Immutable class because its often cached. Obviously you cannot cache anything which is not constant and that make sense why String is Immutable in Java. But this encouraged me to learn more about Mutable and Immutable class in Java and how to create a custom Immutable class in Java.

Saturday, October 7, 2023

Why is Java Considered a Secure Programming Language?

Hello guys, Security is a paramount concern in software development, and choosing the right programming language can play a crucial role in mitigating potential vulnerabilities and threats. Java has long been celebrated for its security features and practices, making it a preferred choice for building secure applications and systems. In this article, we'll explore why Java is considered a secure programming language and examine the features and practices that contribute to its security reputation.

Friday, October 6, 2023

Top 5 JavaScript Data Structure and Algorithm Courses for Beginners to Learn in 2024 - Best of Lot

Hello guys, if you are a JavaScript developer learning Data Structure and Algorithms and looking for the best online course to learn Algorithms and Data Structure in JavaScript, then you have come to the right place. In the past, I have shared free classes to learn JavaScript and data structure Algorithmsand today, I will share the best courses to learn Data Structure and Algorithms. These courses have been created by expert instructors like Colt Steele, Andrei Neagoie, and Stephen Grider and are trusted by thousands of developers. They are also very affordable, especially the Udemy courses you can buy for just $10 on Udemy sales which happens every now and then.

Thursday, October 5, 2023

Top 7 Free Core Spring, Spring MVC, and Spring Boot Courses for Beginners in 2024 - Best of Lot

Hello guys, since 2023 is coming to end in few months, I am updating this article to share with you the best free courses you can join to learn Spring Framework, Spring MVC and Spring Boot in 2024. I have been sharing a lot of resources like books and courses recently and when I published my list of Top 5 courses to learn Spring and Hibernate, many of my readers asked about a similar list of free courses to learn Spring Framework like Core Spring, Spring MVC, Spring Security, and Spring Boot. That request was always back in my mind but I couldn't get time to put together a list, which I can share with you guys, but today is the day. In this list, I have compiled some of the best online free courses to learn Spring Framework from scratch, online at your own pace. 

Sunday, October 1, 2023

Difference between Queue and Deque in Java? Example Tutorial

Hello guys, today I am going to share another interesting question from Java interview, what is difference between Queue and Deque in Java. This question was asked to one of my reader in a recent interview with JP Morgan Mumbai and this is also a popular Java collection interview question. While he was able to answer the question, he wasn't able to convince interviewer so he asked me how to answer this question. So I am writing this post to share my answer on Queue vs Deque in Java. In the vast world of Java programming, the need to manage data efficiently often leads developers to specialized data structures. 

Top 5 Free Courses to learn jQuery for Beginners in 2024 - Best of Lot

Hello guys, if you are thinking of learning jQuery, one of the best JavaScript libraries for client-side development, and looking for some excellent free resources like books, tutorials, and online courses, then you have come to the right place. In this article, I am going to share some of the best free jQuery courses from Udemy and, Pluralsight which you can take to learn this impressive JavaScript library. In the past, I have also shared some free books and tutorials on jQuery, which complements these courses. You can also take a look at them while learning different parts of jQuery.