convert to abstract parent class and nested inner classes for Map.Entry and Iterator