@@ -231,7 +231,7 @@ public Stream<A> _1() {
231231 }
232232
233233 public Stream <A > prefix (final A x , final Stream <A > xs ) {
234- return xs .isEmpty () ? xs : cons (x , p (cons (xs .head (), P . lazy (( ) -> prefix (a , xs .tail ()._1 () )))));
234+ return xs .isEmpty () ? xs : cons (x , p (cons (xs .head (), ( ) -> prefix (a , xs .tail ()._1 ()))));
235235 }
236236 });
237237 }
@@ -287,7 +287,7 @@ public final void foreachDoEffect(final Effect1<A> f) {
287287 */
288288 public final Stream <A > filter (final F <A , Boolean > f ) {
289289 final Stream <A > as = dropWhile (not (f ));
290- return as .isNotEmpty () ? cons (as .head (), P . lazy (( ) -> as .tail ()._1 ().filter (f ) )) : as ;
290+ return as .isNotEmpty () ? cons (as .head (), ( ) -> as .tail ()._1 ().filter (f )) : as ;
291291 }
292292
293293 /**
@@ -297,7 +297,7 @@ public final Stream<A> filter(final F<A, Boolean> f) {
297297 * @return A new stream that has appended the given stream.
298298 */
299299 public final Stream <A > append (final Stream <A > as ) {
300- return isEmpty () ? as : cons (head (), P . lazy (( ) -> tail ()._1 ().append (as ) ));
300+ return isEmpty () ? as : cons (head (), ( ) -> tail ()._1 ().append (as ));
301301 }
302302
303303 /**
@@ -307,7 +307,7 @@ public final Stream<A> append(final Stream<A> as) {
307307 * @return A new stream that has appended the given stream.
308308 */
309309 public final Stream <A > append (final F0 <Stream <A >> as ) {
310- return isEmpty () ? as .f () : cons (head (), P . lazy (( ) -> tail ()._1 ().append (as ) ));
310+ return isEmpty () ? as .f () : cons (head (), ( ) -> tail ()._1 ().append (as ));
311311 }
312312
313313 /**
@@ -550,7 +550,7 @@ public final <B> Stream<B> apply(final Stream<F<A, B>> sf) {
550550 * @return A new stream with elements interleaved from this stream and the given stream.
551551 */
552552 public final Stream <A > interleave (final Stream <A > as ) {
553- return isEmpty () ? as : as .isEmpty () ? this : cons (head (), P . lazy (( ) -> as .interleave (tail ()._1 () )));
553+ return isEmpty () ? as : as .isEmpty () ? this : cons (head (), ( ) -> as .interleave (tail ()._1 ()));
554554 }
555555
556556 /**
@@ -729,7 +729,7 @@ public static <A> Stream<A> forever(final Enumerator<A> e, final A from) {
729729 * given value and stepping at the given increment.
730730 */
731731 public static <A > Stream <A > forever (final Enumerator <A > e , final A from , final long step ) {
732- return cons (from , P . lazy (( ) -> e .plus (from , step ).map (a -> forever (e , a , step )).orSome (Stream .<A >nil () )));
732+ return cons (from , ( ) -> e .plus (from , step ).map (a -> forever (e , a , step )).orSome (Stream .<A >nil ()));
733733 }
734734
735735 /**
@@ -944,7 +944,7 @@ public final A[] array(final Class<A[]> c) {
944944 * @return A new stream with the given element at the head.
945945 */
946946 public final Stream <A > cons (final A a ) {
947- return new Cons <A >(a , P . lazy (( ) -> Stream .this ) );
947+ return new Cons <A >(a , ( ) -> Stream .this );
948948 }
949949
950950 /**
@@ -1279,7 +1279,7 @@ public final Stream<Stream<A>> tails() {
12791279 * @return a stream of the prefixes of this stream, starting with the stream itself.
12801280 */
12811281 public final Stream <Stream <A >> inits () {
1282- final Stream <Stream <A >> nil = Stream .cons (Stream .<A >nil (), P . lazy (( ) -> nil () ));
1282+ final Stream <Stream <A >> nil = Stream .cons (Stream .<A >nil (), ( ) -> nil ());
12831283 return isEmpty () ? nil : nil .append (() -> tail ()._1 ().inits ().map (Stream .<A >cons_ ().f (head ())));
12841284 }
12851285
@@ -1344,12 +1344,12 @@ public static <A> Stream<A> fromFunction(final F<Natural, A> f) {
13441344 * starting at the given value.
13451345 */
13461346 public static <A , B > Stream <A > fromFunction (final Enumerator <B > e , final F <B , A > f , final B i ) {
1347- return cons (f .f (i ), P . lazy ( () -> {
1347+ return cons (f .f (i ), () -> {
13481348 final Option <B > s = e .successor (i );
13491349 return s .isSome ()
13501350 ? fromFunction (e , f , s .some ())
13511351 : Stream .<A >nil ();
1352- })) ;
1352+ });
13531353 }
13541354
13551355 /**
@@ -1388,9 +1388,9 @@ private static final class Cons<A> extends Stream<A> {
13881388 private final A head ;
13891389 private final P1 <Stream <A >> tail ;
13901390
1391- Cons (final A head , final P1 <Stream <A >> tail ) {
1391+ Cons (final A head , final F0 <Stream <A >> tail ) {
13921392 this .head = head ;
1393- this .tail = tail .memo ();
1393+ this .tail = P1 .memo (tail );
13941394 }
13951395
13961396 public A head () {
@@ -1484,7 +1484,7 @@ public static <A> F<A, Stream<A>> single() {
14841484 * @return The stream with the given element prepended.
14851485 */
14861486 public static <A > Stream <A > cons (final A head , final F0 <Stream <A >> tail ) {
1487- return new Cons <A >(head , P . lazy ( tail ) );
1487+ return new Cons <A >(head , tail );
14881488 }
14891489
14901490 /**
@@ -1557,7 +1557,7 @@ public static <A> Stream<A> iterableStream(final Iterable<A> i) {
15571557 public static <A > Stream <A > iteratorStream (final Iterator <A > i ) {
15581558 if (i .hasNext ()) {
15591559 final A a = i .next ();
1560- return cons (a , P . lazy (( ) -> iteratorStream (i ) ));
1560+ return cons (a , ( ) -> iteratorStream (i ));
15611561 } else
15621562 return nil ();
15631563 }
0 commit comments