Skip to content

Commit 0a76120

Browse files
committed
Use lambdas in fj.data.vector
1 parent cceb3d5 commit 0a76120

File tree

6 files changed

+6
-25
lines changed

6 files changed

+6
-25
lines changed

core/src/main/java/fj/data/vector/V3.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,7 @@ public NonEmptyList<A> toNonEmptyList() {
201201
* @return a stream of the elements of this vector.
202202
*/
203203
public Stream<A> toStream() {
204-
return Stream.cons(head()._1(), new P1<Stream<A>>() {
205-
public Stream<A> _1() {
206-
return tail().toStream();
207-
}
208-
});
204+
return Stream.cons(head()._1(), () -> tail().toStream());
209205
}
210206

211207
/**

core/src/main/java/fj/data/vector/V4.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,7 @@ public NonEmptyList<A> toNonEmptyList() {
160160
* @return a stream of the elements of this vector.
161161
*/
162162
public Stream<A> toStream() {
163-
return Stream.cons(head._1(), new P1<Stream<A>>() {
164-
public Stream<A> _1() {
165-
return tail.toStream();
166-
}
167-
});
163+
return Stream.cons(head._1(), () -> tail.toStream());
168164
}
169165

170166
/**

core/src/main/java/fj/data/vector/V5.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,7 @@ public NonEmptyList<A> toNonEmptyList() {
177177
* @return a stream of the elements of this vector.
178178
*/
179179
public Stream<A> toStream() {
180-
return Stream.cons(head._1(), new P1<Stream<A>>() {
181-
public Stream<A> _1() {
182-
return tail.toStream();
183-
}
184-
});
180+
return Stream.cons(head._1(), () -> tail.toStream());
185181
}
186182

187183
/**

core/src/main/java/fj/data/vector/V6.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,7 @@ public NonEmptyList<A> toNonEmptyList() {
194194
* @return a stream of the elements of this vector.
195195
*/
196196
public Stream<A> toStream() {
197-
return Stream.cons(head._1(), new P1<Stream<A>>() {
198-
public Stream<A> _1() {
199-
return tail.toStream();
200-
}
201-
});
197+
return Stream.cons(head._1(), () -> tail.toStream());
202198
}
203199

204200
/**

core/src/main/java/fj/data/vector/V7.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,7 @@ public NonEmptyList<A> toNonEmptyList() {
211211
* @return a stream of the elements of this vector.
212212
*/
213213
public Stream<A> toStream() {
214-
return Stream.cons(head._1(), new P1<Stream<A>>() {
215-
public Stream<A> _1() {
216-
return tail.toStream();
217-
}
218-
});
214+
return Stream.cons(head._1(), () -> tail.toStream());
219215
}
220216

221217
/**

core/src/main/java/fj/data/vector/V8.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ public NonEmptyList<A> toNonEmptyList() {
229229
*/
230230
public Stream<A> toStream() {
231231
return Stream.cons(head._1(), new P1<Stream<A>>() {
232+
F0<Stream<A>> f = 100;
232233
public Stream<A> _1() {
233234
return tail.toStream();
234235
}

0 commit comments

Comments
 (0)