for ( SomeListElement element : objectWithList.getList() ) { ... }
What is the above snippet translated to?
What I am mostly interested in is if the getList() method called once, or with each iteration/element?
 for ( SomeListElement element : objectWithList.getList() ) { ... }
What is the above snippet translated to?
What I am mostly interested in is if the getList() method called once, or with each iteration/element?
 
    
    Its equivalent to
for(Iterator<SomeListElement> i = objectWithList.getList().iterator(); 
                                                              i.hasNext(); ) {
  SomeListElement element = i.next();
  //access element here
}
 
    
    