Difference between revisions of "DoubleDeltaRange"
Jump to navigation
Jump to search
(Created page with "=Motivation= Experience implementing the Iterable<T> interface. =Mistakes To Avoid= {{warning | Do NOT Parallelize}} =Investigate= interface [https://docs.oracle.com/javase/...") |
|||
Line 9: | Line 9: | ||
interface [https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html Iterator<T>] | interface [https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html Iterator<T>] | ||
+ | |||
+ | <youtube>Dww-_5EiwA8</youtube> | ||
=Code to Implement= | =Code to Implement= |
Revision as of 05:18, 28 January 2020
Contents
Motivation
Experience implementing the Iterable<T> interface.
Mistakes To Avoid
Warning: Do NOT Parallelize |
Investigate
interface Iterable<T>
interface Iterator<T>
Code to Implement
DoubleRange
To implement this class you will need to declare and initialize fields. You should NOT create a List<Double> and fill it with the necessary values. The iterator should produce each next value live.
class DoubleRange implements Iterable<Double>
class: | DoubleRange.java | |
methods: | constructor iterator() |
|
package: | doublerange.warmup | |
source folder: | student/src/main/java |
constructor
method: public DoubleRange(double minInclusive, double maxExclusive, double delta)
(sequential implementation only)
iterator()
method: public Iterator<Double> iterator()
(sequential implementation only)
Although, you can create a named class, we encourage you to use this opportunity to create an instance of an anonymous class here.
Testing Your Solution
Correctness
class: | DoubleRangeTestSuite.java | |
package: | doublerange.warmup | |
source folder: | testing/src/test/java |