added foreach method to map class