source: java2python/core/src/test/iterator/testcode/MyIterable.java

Last change on this file was 800, checked in by wouter, 6 months ago

converted javax.annotation to org.eclipse.jdt.annotation because javax is deprecated and no maven substitute available.

File size: 558 bytes
Line 
1package testcode;
2
3import java.util.Arrays;
4import java.util.Iterator;
5
6import org.eclipse.jdt.annotation.NonNull;
7
8/**
9 * This object extends Iterable, and therefore the iterator function should
10 * translate as __iter__.
11 */
12public class MyIterable implements Iterable<Integer> {
13
14 @Override
15 public @NonNull Iterator<Integer> iterator() {
16 return Arrays.asList(5, 6).iterator();
17 }
18
19 static public void main(String[] args) {
20
21 @NonNull
22 MyIterable obj = new MyIterable();
23 for (@NonNull
24 Integer v : obj) {
25 System.out.print(v.toString());
26 }
27 }
28}
Note: See TracBrowser for help on using the repository browser.