groovy-stream updates and Java integration

So a quick post about the latest release (0.8.0) of groovy-stream.

In a nutshell, this update has removed a couple of things, and added support for using groovy-stream from Java.

Read More

caterpillar-case, camelCase and snake_case, oh my!

Sometimes when coding, you need to switch between letter case formats.  Rather than rolling your own, or using a regular expression (shudder), you can leverage the CaseFormat enumeration in Guava.

Read More

A miniKanren in Groovy

Finally got a working implementation of a miniKanren in Groovy (I basically ported the ruby version that can be found here).

The source code can be found over here

Read More

Changing body class in Grails

I hit a situation where I needed to be able to change the body class for a Grails view, but found that simply setting it in the body does not work.

Read More

groovy-common-extensions v0.5

A new version of groovy-common-extensions is out with a new method tap.

Read More

Rendering anti-aliased text over semi-transparent backgrounds in Java/Groovy

Another blog post that’s more for me in the future so I don’t forget ;-)

Thought it might be of use to someone else as well, so posted it here for posterity.

So I recently had issues with rendering anti-aliased text over translucent backgrounds inside a Java app.  Here’s a quick Groovy script that shows the problem:

Read More

Rock Paper Scissors with Groovy-stream

As a bit of fun (after reading Alex Miller's example of Clojure’s core-async library), I decided to implement Rock Paper Scissors using my groovy-stream library.  It feels quite nice to end up with a Stream Iterator that plays a game each time you call next().

Read More

Object destructuring with getAt in Groovy

One thing I only recently learned about Groovy is that by implementing the getAt method, you can destructure your Object via multiple assignment.

As an example, consider a class Vector2D which represents a two-dimensional vector:

Read More

Lazy squares using groovy-stream

Last night, I saw a post on my twitter feed titled “Why Functional Programming in Java is Dangerous where the author tries to implement the clojure code

in a functional style in Java, then concludes that “Functional idioms in Java are performance bugs waiting to bite you” after trying to load all of the Integers Java can handle into an ArrayList.

Read More

Groovy-stream library now on Maven

Buoyed by my success pushing the groovy-common-extensions library to maven, I pushed the groovy-stream library to maven as well, so it’s now possible (without any messing around with @GrabResolver) to give the library a whirl.

Read More