Skip to content

Commit fe19604

Browse files
committed
fix missing max value of bounded
1 parent 6cadc81 commit fe19604

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

core/src/main/java/fj/data/Enumerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public Stream<A> toStream(final A a) {
190190
*/
191191
public Stream<A> toStream(final Bounded<A> bounded) {
192192
final F<A, A> id = identity();
193-
return Stream.fromFunction(this, id, bounded.min()).takeWhile(item -> !item.equals(bounded.max()));
193+
return Stream.fromFunction(this, id, bounded.min()).takeWhile(item -> order.isLessThanOrEqualTo(item, bounded.max()));
194194
}
195195

196196
/**

core/src/test/java/fj/MonoidTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void intersection_monoid_test() {
2929
assertThat(actual, is(Set.set(Ord.intOrd, 3, 4)));
3030
}
3131

32-
@Test
32+
@Test
3333
public void union_monoid_test() {
3434
Monoid<Set<Integer>> unionMonoid = Monoid.setMonoid(Ord.intOrd);
3535
Set<Integer> first = Set.set(Ord.intOrd, 1, 2, 3, 4);
@@ -42,7 +42,7 @@ public void union_monoid_test() {
4242
public void intersection_monoid_zero_test() {
4343
Bounded<Integer> integersBounded = Bounded.bounded(0, 10);
4444
Monoid<Set<Integer>> monoid = Monoid.setIntersectionMonoid(integersBounded, Enumerator.intEnumerator);
45-
Set<Integer> set = Set.set(Ord.intOrd, 1, 2, 3, 4);
45+
Set<Integer> set = Set.set(Ord.intOrd, 7, 8, 9, 10);
4646
Set<Integer> zero = monoid.zero();
4747
assertThat(monoid.sum(zero, set), is(set));
4848
}

0 commit comments

Comments
 (0)