Difference between revisions of "Iterable Range Assignment"
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
<nowiki>public static Iterable<Integer> minToMaxExclusive(int min, int maxExclusive)</nowiki> | <nowiki>public static Iterable<Integer> minToMaxExclusive(int min, int maxExclusive)</nowiki> | ||
+ | |||
+ | =Performance= | ||
+ | The code: | ||
+ | <nowiki>for(int i : Ranges.minToMaxExclusive(4, 12)) { | ||
+ | System.out.println(i); | ||
+ | }</nowiki> | ||
+ | |||
+ | produces the output: | ||
+ | <nowiki>4 | ||
+ | 5 | ||
+ | 6 | ||
+ | 7 | ||
+ | 8 | ||
+ | 9 | ||
+ | 10 | ||
+ | 11</nowiki> | ||
+ | |||
=Test= | =Test= | ||
{{TestSuite|RangesTestSuite|range.assignment}} | {{TestSuite|RangesTestSuite|range.assignment}} |
Revision as of 19:24, 30 July 2019
Code To Implement
minToMaxExclusive
class: | Ranges.java | ![]() |
methods: | minToMaxExclusive | |
package: | range.assignment | |
source folder: | src/main/java |
public static Iterable<Integer> minToMaxExclusive(int min, int maxExclusive)
Performance
The code:
for(int i : Ranges.minToMaxExclusive(4, 12)) { System.out.println(i); }
produces the output:
4 5 6 7 8 9 10 11
Test
class: | RangesTestSuite.java | ![]() |
package: | range.assignment | |
source folder: | src/test/java |