Last active
October 11, 2015 10:48
-
-
Save aruld/3847475 to your computer and use it in GitHub Desktop.
Updated to compile with the latest lambda build 94.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package java.util.stream; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.Collection; | |
public class MyList<E> extends ArrayList<E> { | |
public MyList(int initialCapacity) { | |
super(initialCapacity); | |
} | |
public MyList() { | |
super(); | |
} | |
public MyList(Collection<? extends E> c) { | |
super(c); | |
} | |
@Override | |
public MyStream<E> stream() { | |
return new MyReferencePipeline<>(Arrays.spliterator((E[]) this.toArray(), 0, this.size()), StreamOpFlag.IS_SIZED | StreamOpFlag.IS_ORDERED, false); | |
} | |
@Override | |
public Stream<E> parallelStream() { | |
return new MyReferencePipeline<>(Arrays.spliterator((E[]) this.toArray(), 0, this.size()), StreamOpFlag.IS_SIZED | StreamOpFlag.IS_ORDERED, true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment