Collectors are having Java memory issue