Postingan

Menampilkan postingan dengan label Stream API examples

How to use filter + map + collect + Stream in Java? Example Tutorial

Gambar
Hello guys, many of my readers emailed me to write a post about the map and filter function of Java 8 because they found it difficult to understand and use. Even though I have previously blogged about both map() and filter(), I am writing this post again to explain the concept in more layman's language for a better understanding of my readers and fellow Java developers. The map() function is a method in Stream class which represents a functional programming concept. In simple words, the map() is used to transform one object into another by applying a function . That's the reason the Stream.map(Function mapper) takes a function as an argument. For example, by using map() function, you can convert a list of String into List of Integer by applying Integer.valueOf() method to each String on the input list. All you need is a mapping function to convert one object to another, and the map() function will do the transformation for you. It is also an intermediate stream operation whi...

Top 5 Courses to learn Functional Programming in Java with Lambda Expression and Stream - Best of Lot

Gambar
Hello guys, if you remember, Java 8 changed the way we usually code in Java by introducing some Functional Programming concepts. It brings features like lambda expressions and Streams, which give birth to new patterns that result in clean code in Java. Now there is a better and more declarative way to write Java. If you use them correctly, then they can express the intent of code better and thus makes it easier to read and maintain. There is another bit which many people miss is the introduction of Functional programming concepts like the map, reduce, flatmap, and filter, which enable us to write more readable code in Java. If you know functional programming or want to learn functional programming in Java then you have come to the right place. In this article, I'll share some excellent courses to learn functional programming in Java. These courses will help you to master Functional Programming and write unique Java code using Streams, Lambda Expressions, Functional Interfaces, and ...