Word Chain Kata

Joe Bowbeer joe.bowbeer at gmail.com
Mon Jan 14 14:54:24 PST 2013


I wrote a Java8 version of the Word Chains problem from codekata.pragprog.com.

Mercurial Project: https://bitbucket.org/joebowbeer/wordchainkata

The interesting parallel piece is the method below that finds all the
words that are adjacent to a given word:

  protected Collection<String> findNeighbors(String word) {
    return words.parallelStream().filter(s -> adjacent(s,
word)).into(new ArrayDeque<String>());
  }

Where words is a set of n-letter words (obtained from
icon.shef.ac.uk/Moby/mwords.html) and adjacency is defined as
differing in exactly one character.


This was developed in NetBeans build #1605 for jdk8lambda and compiles
and runs on jdklambda b72.  I'll update this once the replacement for
into() makes it into the binary snapshot...


--Joe


More information about the lambda-libs-spec-observers mailing list