Migrate to unsynchronized data structures

Most new Java code uses `StringBuilder` and `HashMap` instead of their synchronized counterparts, unless there is some explicit need for synchronization. This pull request does not imply any change to external APIs or public instance variables.