Skip to content

Commit affc277

Browse files
authored
Properly document .every(), mention Java 9 solution. (#4)
* Documentation for .every(), reword Java9 solution
1 parent d919151 commit affc277

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ To use this library in your project, add this to your dependencies:
1313

1414
These are fully functional streams, so you can use them like any other stream, once created.
1515

16-
Once `Stream.takeWhile()` support is added in Java 9, this library will not be very useful. The lack
17-
of a convenient `takeWhile(Predicate<T> predicate)` method in Java 8 is what lead to the creation
18-
of this library.
19-
16+
The lack of a convenient `takeWhile(Predicate<T> predicate)` method in Java 8 is what led to the creation
17+
of this library. Now that Java 9 has `Stream.takeWhile()` support, there is no reason to add this as a dependency.
2018

2119
This library can create streams of the following java.time classes:
2220

@@ -51,6 +49,13 @@ To make the optional end of the stream exclusive, you can call one of two method
5149
+ `.until(T to)` - Type-specific end point. Can be null to indicate forever
5250
+ `.until(amount, units)` - Where `amount` is a positive integer (for forward through time) or a negative integer (for backward through time), and `unit` is a valid `ChronoUnit`
5351

52+
To indicate how much time should be skipped in each iteration:
53+
54+
+ `.every(amount, units)` - Where `amount` is an integer representing the number of units, and `unit` is a valid `ChronoUnit`
55+
+ `.every(period)` - Where `period` is a valid `Period` object. (Supported on `LocalDateStream` and `YearMonthStream` only).
56+
+ `.every(duration)` - Where `duration` is a valid `Duration` object. (Supported on everything other than `LocalDateStream` and `YearMonthStream`).
57+
58+
5459
Note that providing an end time (via `to` or `until`) is optional. In that case, the stream will
5560
have no end and should produce values until you stop it.
5661

0 commit comments

Comments
 (0)