Skip to content

anyulled/java-8-streams-intro

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code repository for Training JSE8 - Intro to Streams


Exercises:

Basic stream (Jse8_streams/src/main/java/part1/basic/exercises):

  • Implement commented TODO lines at Sample1A_StreamBasicExercise.java using streams.
  • Implement commented TODO lines at Sample1B_TraversingExercise.java using streams.

Generators (Jse8_streams/src/main/java/part2/generators/exercises):

  • Implement commented TODO lines at GeneratorExercise.java using streams.

Filtering (Jse8_streams/src/main/java/part3/filtering/exercises):

  • Given FileManagerExercise.java class, implement using streams, read the lines at data.txt file and count how many are different ignoring the first line. Also, count how many lines are different ignoring those lines starting with ‘==‘.
  • Given FileManagerExercise.java class, implement using streams and filter, read the lines at data.txt file and print them out ordered in ascending and descending order.
  • Given FileManagerExercise.java class, implement using streams, read the lines at data.txt file and count how many words are in each line. Also show the line and the count of words in the line using peek functionality.

Collect(Jse8_streams/src/main/java/part4):

  • Given the list at TransactionManagerExercise.java class, print the name of the traders. Also print the unique names sorted adding values to a TreeSet.
  • Given the list at TransactionManagerExercise.java class, print the unique (grouping) name of the traders and the sum of total amounts. Also print the unique names within the years when they have transactions in a new line.
  • Read the lines at data.txt file and verify all lines contains the text ‘lazy’.
  • Read the lines at data.txt file and print the first line which contains the text ‘cat’.
  • Given the list at TransactionManagerExercise.java class, print the transaction with the highest amount.
  • Given the list at TransactionManagerExercise.java class, print the transaction with the sum of all amounts within the last year of transaction.

Optional (Jse8_streams/src/main/java/part5/exercises):

  • Avoid possible NullPointerExceptions errors adding a method getNullSafeValue using Optional API in the OptionalExercise.java.

Query like practice (Jse8_streams/src/main/java/part9/exercises):

  • Follow the comments to complete the QueriesLikeExercises.java file practicing streams.

About

Java 8 - intro to streams

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%