Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement Java 8 Stream API using Java 7 or older?

I was asked this question in a job interview (Microsoft).
methods to implement for example:
.stream(), .filter(), .map() , flatMap() , min() , count() , reduce() , groupBy()
etc

It's quite an open question but I think is an interesting one.

Thanks

like image 366
belostoky Avatar asked Oct 17 '22 03:10

belostoky


1 Answers

One way to get an ability to use StreamAPI in your Java7 and Java6 projects add a streamsupport library https://github.com/streamsupport/streamsupport Streamsupport is a backport of the Java 8 java.util.function (functional interfaces) and java.util.stream (streams) API for users of Java 6 or 7

like image 109
Oleg Ushakov Avatar answered Oct 20 '22 23:10

Oleg Ushakov