Skip to content

Playing dirty with functional java8 style streaming api. No tests methods! just only a main class with lines of code of a java 10 jshell . I felt lazy... :)

Notifications You must be signed in to change notification settings

alonsoir/java8-streaming

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

java8-streaming

playing with functional java8 style streaming api.

actual output

25000.0
28000.0
28000.0
30000.0

total sum is 201000.0
max product price is 90000.0
min product price is 25000.0
productPriceSet is [25000.0, 28000.0]
productPriceMap is {1=HP Laptop, 2=Dell Laptop, 3=Lenevo Laptop, 4=Sony Laptop, 5=Apple Laptop}
productPriceList is [90000.0]
Now parallelizing...
25000.0
28000.0
28000.0
30000.0
total sum is 201000.0

max product price is 90000.0
min product price is 25000.0
productPriceSet is [25000.0, 28000.0]
productPriceMap is {1=HP Laptop, 2=Dell Laptop, 3=Lenevo Laptop, 4=Sony Laptop, 5=Apple Laptop}
productPriceList is [90000.0]
Creating stream from collection, set or array...
JAVA
J2EE
Spring
Hibernate
JAVA
J2EE
Spring
Hibernate
JAVA
Hibernate
J2EE
Spring

Array can also be a source of a Stream...
a
b
c
a
b
c
b
c
from streamBuilder...
a
b
c
From Stream.generate()...
element
element
element
element
element
element
element
element
element
element
From Stream.iterate()...
1
3
5
7
9
Stream of File...
// Attention, file not provided, use your own file!
2018/05/06 20:54:42,200 WARN BaseVisitor There were configuration errors!
LoosePackageCoupling: No packages or classes specified

2018/05/06 20:54:42,200 WARN BaseVisitor There were configuration errors!
LoosePackageCoupling: No packages or classes specified

Stream of Primitives...
1
2
1
2
3
0.050415604442980655
0.47084556420331924
0.24412032084607604

sorting a hashMap by value
{b=10, c=12, d=20, a=21}

reading historico_euromillones.csv sorted by total_2017, 7 values...
EMPojo [number=17, total=131, total_2017=16, total_2018=15]
EMPojo [number=30, total=127, total_2017=16, total_2018=7]
EMPojo [number=20, total=119, total_2017=14, total_2018=12]
EMPojo [number=4, total=132, total_2017=13, total_2018=10]
EMPojo [number=10, total=125, total_2017=13, total_2018=6]
EMPojo [number=19, total=126, total_2017=13, total_2018=3]
EMPojo [number=27, total=121, total_2017=13, total_2018=8]

reading historico_euromillones.csv sorted by total_2018, 7 values...
EMPojo [number=15, total=126, total_2017=9, total_2018=17]
EMPojo [number=17, total=131, total_2017=16, total_2018=15]
EMPojo [number=23, total=135, total_2017=10, total_2018=15]
EMPojo [number=44, total=138, total_2017=13, total_2018=14]
EMPojo [number=48, total=109, total_2017=11, total_2018=14]
EMPojo [number=31, total=115, total_2017=13, total_2018=13]
EMPojo [number=50, total=140, total_2017=11, total_2018=13]

About

Playing dirty with functional java8 style streaming api. No tests methods! just only a main class with lines of code of a java 10 jshell . I felt lazy... :)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages