Skip to content

Latest commit

 

History

History
46 lines (23 loc) · 1.54 KB

README.md

File metadata and controls

46 lines (23 loc) · 1.54 KB

streamkata

A code kata to practise Java 8 functional programming with streams
You need jdk 8 to run it, and maven to build the project

Your mission - Primary Objectives

This kata lets you experiment with Streams and functional programming in Java 8.

The exercise is based around two interfaces:

  • MessageAnalyser
  • DecryptingAnalyser

You need to implement these interfaces to find words and phrases in a plain text file or from an encrypted file

Two working but awful implementations are provided, along with tests
Complete the Stream based implementations to make the stream tests pass

Start with the tests in com.od.streamkata.plaintext
Once you have those working work on com.od.streamkata.decrypting

Use as much cool stuff from JDK 8 as you feel you can justify.

  • Get familiar with Streams, Predicates, Map and FlatMap, Collectors
  • Try lambda expressions, method references and functions as instances of java.util.function.Function and its related classes
  • Use 'Try-With-Resources (from jdk 1.7)' to keep things tidy since Stream implements AutoCloseable
  • How is the 'Spliterator' related to the Stream API?
  • To what extent will be benefit from parallelism in the streams used for this exercise?

Your mission - Secondary Targets

If you get finished early, here are some more possible exercises:

  • Add a method to return a List of Tuple, where the Tuple contains a line number and a search result. Implement Tuple
  • Add a method to return the number of times each word appears, given a list of search words as input