File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
core/src/main/java/fj/data Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 1
1
package fj .data ;
2
2
3
- import fj .F ;
3
+ import fj .* ;
4
4
5
5
import static fj .Function .*;
6
6
import static fj .data .Option .none ;
7
7
import static fj .data .Option .some ;
8
8
9
- import fj .Function ;
10
- import fj .Ord ;
11
-
12
9
import static fj .Ord .*;
13
- import fj .Ordering ;
14
10
import static fj .Ordering .*;
15
11
16
12
import java .math .BigDecimal ;
@@ -185,6 +181,18 @@ public Stream<A> toStream(final A a) {
185
181
return Stream .fromFunction (this , id , a );
186
182
}
187
183
184
+ /**
185
+ * Returns a stream of the values from this enumerator,
186
+ * starting at the min of given Bounded, ending at the max, counting up.
187
+ *
188
+ * @param bounded A value at which to begin the stream.
189
+ * @return a stream of the values from this enumerator, cut by bounded, counting up.
190
+ */
191
+ public Stream <A > toStream (final Bounded <A > bounded ) {
192
+ final F <A , A > id = identity ();
193
+ return Stream .fromFunction (this , id , bounded .min ()).takeWhile (item -> !item .equals (bounded .max ()));
194
+ }
195
+
188
196
/**
189
197
* Create a new enumerator with the given minimum value.
190
198
*
You can’t perform that action at this time.
0 commit comments