OnJava8-Examples/generics/BasicGeneratorDemo.java

20 lines
440 B
Java
Raw Normal View History

2015-09-07 11:44:36 -06:00
// generics/BasicGeneratorDemo.java
2015-06-15 17:47:35 -07:00
// <20>2015 MindView LLC: see Copyright.txt
import com.mindviewinc.util.*;
public class BasicGeneratorDemo {
public static void main(String[] args) {
Generator<CountedObject> gen =
BasicGenerator.create(CountedObject.class);
for(int i = 0; i < 5; i++)
System.out.println(gen.next());
}
2015-09-07 11:44:36 -06:00
}
/* Output:
2015-06-15 17:47:35 -07:00
CountedObject 0
CountedObject 1
CountedObject 2
CountedObject 3
CountedObject 4
2015-09-07 11:44:36 -06:00
*/