Could this be implemented a good deal more efficiently and simply: Class prevClass = null; Iterator i = content.iterator(); while (i.hasNext()) { Object obj = i.next(); Class newClass = obj.getClass(); if (newClass != prevClass) { if (prevClass != null) { return true; } prevClass = newClass; } } return false;