3232import java .util .function .Consumer ;
3333import java .util .function .Function ;
3434import java .util .function .Predicate ;
35- import java .util .stream .Collectors ;
3635
3736/**
3837 * The iterable with primitive operations witch simplify typical actions like count, map, etc.
@@ -93,7 +92,7 @@ default boolean none(Predicate<X> first, Predicate<X>... other) {
9392 */
9493 default Enumerable <X > select (Predicate <X > first , Predicate <X >... other ) {
9594 return new Linked <>(
96- this .stream ().filter (new Joined <>(first , other )). collect ( Collectors . toList ())
95+ this .stream ().filter (new Joined <>(first , other ))
9796 );
9897 }
9998
@@ -117,7 +116,7 @@ default Enumerable<X> reject(Predicate<X> first, Predicate<X>... other) {
117116 }
118117 }
119118 }
120- return new Linked <>(this .stream ().filter (prd ). collect ( Collectors . toList ()) );
119+ return new Linked <>(this .stream ().filter (prd ));
121120 }
122121
123122 /**
@@ -157,9 +156,7 @@ default <Y> Enumerable<Y> map(Function<? super X, ? extends Y> fnc) {
157156 if (fnc == null ) {
158157 out = new Empty <>();
159158 } else {
160- out = new Linked <>(
161- this .stream ().map (fnc ).collect (Collectors .toList ())
162- );
159+ out = new Linked <>(this .stream ().map (fnc ));
163160 }
164161 return out ;
165162 }
@@ -308,9 +305,7 @@ default Enumerable<X> take(long num) {
308305 } else if (num == 0 ) {
309306 out = new Empty <>();
310307 } else {
311- out = new Linked <>(
312- this .stream ().limit (num ).collect (Collectors .toList ())
313- );
308+ out = new Linked <>(this .stream ().limit (num ));
314309 }
315310 return out ;
316311 }
@@ -329,9 +324,7 @@ default Enumerable<X> drop(long num) {
329324 } else if (num == 0 ) {
330325 out = this ;
331326 } else {
332- out = new Linked <>(
333- this .stream ().skip (num ).collect (Collectors .toList ())
334- );
327+ out = new Linked <>(this .stream ().skip (num ));
335328 }
336329 return out ;
337330 }
0 commit comments