Fundamentals

Default Methods

Collections

Idioms and Techniques

Design Rationale

Advanced Questions

How can I turn an array into an Iterator?

If you have an array of reference type, the easiest way is to turn it into a List. Nothing new here:

MyObject[] array = … ; Iterator<MyObject> iterator = Arrays.asList(array).iterator();

Difficulties arise if you have an array of primitives. If you have an int array, passing it to Arrays.asList() doesn’t result in a […]