Add test case, and fix the bug it exposes, in empty list handling.
Merge branch 'master' of https://github.com/IanDarwin/javasrc