File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic

How to make my class iterable?

 
Theodore David Williams
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
You need to implement the Iterable<T> interface.

Edit...incidentally, you can get that by looking at the language specification:
14.14.2 The enhanced for statement
The enhanced for statement has the form:
for ( VariableModifiersopt Type Identifier: Expression) Statement
The Expression must either have type Iterable or else it must be of an array type, or a compile-time error occurs.
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please read this. Closing thread.
 
I agree. Here's the link: http://aspose.com/file-tools
    Bookmark Topic Watch Topic
  • New Topic