Ported a pull request to the other languages

See: https://github.com/twitter/effectivescala/pull/48
Merge pull request #50 from jjinux/master

Ported a pull request to the other languages