I am programming for a device with a memory limit. Therefore, I want to avoid allocating any memory.
Obviously, an iteration between sets, lists, etc. allocates an iterator and therefore allocates memory. Therefore, this should be avoided.
Is Java's own syntax for iterating over memory allocating arrays?
Object[] array = getArray() for(Object elem: array){
(I suppose I could always use the old-fashioned for loop with an index variable.)
source share