List list = getList(); // from somewhere, say a list of Person Iterator it = list.iterator(); while(it.hasNext()){ // the following line makes perfect sense to me, // but it causes a compiler error, I'm supposed to write: // Person p = (Person)it.next(); // my question: Is the compiler helping me or I'm helping the compiler? Person p = it.next(); // now call some method on p. }