Implemented the Hash::groupBy method