Showing posts with label Streams. Show all posts
Showing posts with label Streams. Show all posts
January 02, 2020
July 29, 2018
Exceptions in Java 8 Streams and Lambda Expressions
Java 8 Lambda Expressions allow us to do functional programming, but sadly they don't deal with exceptions very well.
Handling Unchecked Exceptions
Let's say we have a list of integers and we are dividing a constant number (lets say 16) with every element of this list, we need to print result of this division.
List < Integer > myList = Arrays.asList(7, 9, 16, 25, 27);
myList.forEach(i - > System.out.println(16 / i));
Handling Unchecked Exceptions
Let's say we have a list of integers and we are dividing a constant number (lets say 16) with every element of this list, we need to print result of this division.
List < Integer > myList = Arrays.asList(7, 9, 16, 25, 27);
myList.forEach(i - > System.out.println(16 / i));
April 04, 2017
#Java8 : Streams in Java 8 interview questions and answers
What is a Java Stream?
A stream represents a sequence of elements and supports different kind of operations to perform computations upon those elements.
In a simple term, a stream is an iterator whose role is to accept a set of actions to apply on each of the elements it contains.
A stream represents a sequence of elements and supports different kind of operations to perform computations upon those elements.
In a simple term, a stream is an iterator whose role is to accept a set of actions to apply on each of the elements it contains.
Subscribe to:
Posts (Atom)