Java library for merging object of the same type