Difference between revisions of "PowersOf2Iterable"
Jump to navigation
Jump to search
| Line 2: | Line 2: | ||
Experience with implementing interfaces. | Experience with implementing interfaces. | ||
=Investigate= | =Investigate= | ||
| − | [https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html | + | interface [https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html Iterable<T>] |
| − | [https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html | + | interface [https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html Iterator<T>] |
=Mistakes To Avoid= | =Mistakes To Avoid= | ||
Revision as of 04:16, 18 January 2020
Contents
Motivation
Experience with implementing interfaces.
Investigate
interface Iterable<T>
interface Iterator<T>
Mistakes To Avoid
Code to Implement
| class: | PowersOfTwoLessThan.java | |
| methods: | constructor iterator |
|
| package: | slices.studio | |
| source folder: | student/src/main/java |
constructor
method: public PowersOfTwoLessThan(int maxExclusive)
(sequential implementation only)
iterator
method: public Iterator<Integer> iterator()
(sequential implementation only)
Testing Your Solution
Correctness
| class: | PowersOfTwoTestSuite.java | |
| package: | powersoftwo.studio | |
| source folder: | testing/src/test/java |