Community
Participate
Working Groups
Build Identifier: M20110210-1200 I'm trying to code as follows, however, I'm getting an error message, any idea why? private static ArrayList<Player> getWinner(ArrayList<Player> _players) { ... for (int i = 0; i < _players.size(); i++) { for (Card _card: _players.get(i)) { } } return _winners; ... } Error: Can only iterate over an array or an instance of java.lang.Iterable According to the Java API for 1.6, ArrayList implements Iterable<E> - http://download.oracle.com/javase/6/docs/api. Reproducible: Always
Created attachment 193969 [details] Source code (dummy)
Sorry, where in that example are you attempting to iterate over an ArrayList using the foreach syntax?
(In reply to comment #2) > Sorry, where in that example are you attempting to iterate over an ArrayList > using the foreach syntax? Yes, is my coding incorrect?
(In reply to comment #3) > (In reply to comment #2) > > Sorry, where in that example are you attempting to iterate over an ArrayList > > using the foreach syntax? > Yes, is my coding incorrect? I found a sample at http://leepoint.net/notes-java/flow/loops/foreach.html.
Bugzilla is not here to answer coding questions. Use a Java newsgroup for that.
(In reply to comment #5) > Bugzilla is not here to answer coding questions. Use a Java newsgroup for that. Noted