Tag: foreach
-
How to find the leader numbers in an array using stream
This is the third solution to find the leader numbers in an array in the reverse direction using stream. An element is leader if it is greater than all the elements to its right side. And the rightmost element is always a leader
-
How to find the pairs of numbers from an array whose sum is divisible by 9 using stream
This is the third solution to find the pairs of numbers in which their sum is divisible by 9 from an array of integers. This method uses nested IntStreams to traverse the array , add any two numbers come across in each iteration, and then uses a simple predicate to verify that the sum is…
-
How to find Missing Prime numbers from any given sequence of integers using Stream
This is the second solution to find the missing prime numbers from any given sequence of integers. This solution uses the Lambda expression with single abstract method. The solution also uses the range, filter, foreach methods of IntStream.
-
How to remove duplicate numbers in an Array of integers using stream
This is the third solution to remove the duplicate numbers from an Array of integers. This program uses distinct method of Stream in the Arrays.
-
How to reverse all the numbers in an array of integers using stream
This is the third solution to reverse all the numbers in the given array. This solution uses IntStream, range and map methods.
-
How to move zero’s to end in an array List of integers using streams
This is the third solution to move all Zero numbers to the end of an arrayList. This solution uses filter(), map() methods of stream. The resultant arrayList has all the exists zero’s moved to end.
