A counterexample will be that Integerthere is an object in Java , but intnot, which means that different operations are applied to them (admittedly, in recent Java there is an automatic conversion to / from the version of the object, but this may introduce unexpected performance problems) . Objects are a bit slower due to indirection, but more flexible; everything that is an object means that everything behaves sequentially. Again Java will be an example: an array is not an object, but ArrayIteratoris what is locked after the fact (with several third-party implementations, even) and, therefore, is not entirely consistent with how collection class iterators work.
source
share