Hi, Compilation error occurs due to tm.get(it.next()); This statement returns Object. Integer iw = tm.get(it.next());-- In this statement iw is object of class Integer. As you are trying to assign instance of class Object to Integer this error occurs. As Integer is subclass and Object is base class you cannot assign subclass instance to instance of base class Object. So before assigning just cast it to type Integer and the problem is solved.
Use Integer iw = (Integer)tm.get(it.next()); instead of 10th statement.