Is the casting necessary? Are you using any HashMap specific methods?