A Groovy script to naively calculate the Fibonacci series inspired by the example here.
Note: a version using memoizing will be much more efficient but this illustrates using Java's built-in concurrency primitives from Groovy.
Which produces this:
If you want to convince yourself that some threads are actually being created, replace the last
each line with:
which will add something like the following to your output: