Wednesday, July 06, 2016

String.trim is an optimization hack

Turns out java.lang.String.trim() has its own unique definition of "whitespace" in order to be able to reuse the same underlying char array.

This blog post from 2008 talks in a lot of detail:

Guards in Java

Haskell functions have this nice concept called 'guards' which allow you to define a condition and return a value when that conditi...