Fixed some java issues and added declarations for collections

Hi,

I fixed some minor issues and added 3 snippets for Java.

Thanks,
Ole