restrict V type of foldByKey in order to retain ClassManifest; added foldByKey to Java API and test