Oracle MOOC on Lambdas and Streams: Week 3 homework in Java and Scala
Part 1: A file called “words” is provided containing a large collection of words. A template file, RandomWords.java, is also provided. In the constructor you need to read all the words (which are one per line) from the source file into a list (remember to use a stream to do this). You also need to write the body of the createList() method. This generates a list of the size specified as a parameter selecting words at random from the list read in the constructor.
Oracle MOOC on Lambdas and Streams: Week 2 homework in Java and Scala
Exercise 1: Create a new list with all the strings from original list converted to lower case and print them out.
For this week homework we’ll start using the infamous Java 8 Streams, finally, being restricted as we were last week. The Collection interface had a new method added on the JDK 8, a default one, called stream(). It will, as its Javadoc states, “Returns a sequential Stream with this collection as its source”.
Oracle MOOC on Lambdas and Streams: Week 1 homework in Java and Scala
This post is the first of a series covering the implementation of the home work for this MOOC by Oracle. The course is about Lambdas and Streams on Java 8, but I felt compelled to implement them also in Scala, and compare both implementations. On this post and the next two, I’ll try to explain the main differences between these implementations and the way both languages empower you to use high order functions as part of a functional programming way of solving problems.