(Java) Using primitive arrays instead of Object with map/builder
also simplify and consolidate the builder generic value write handling
fixes #3279