I'm attempting to extend Java 8's Stream implementation.
I have this interface:
public interface StreamStuff<T> extends Stream<T> {
    Stream<T> delegate();
    default Stream<T> biggerThanFour() {
        return delegate().filter(i -> ((Double)i > 4));
    }
}
And in my main method:
int arr [] = {1,2,3,4,5,6};
Object array [] = ((StreamStuff)Arrays
            .stream(arr))
            .biggerThanFour()
            .toArray();
I'm trying to cast the Stream, to my interface StreamStuff, and use my method.
Im getting the following error:
Exception in thread "main" java.lang.ClassCastException: java.util.stream.IntPipeline$Head cannot be cast to StreamStuff
I get the same error when I do:
StreamStuff ss = (StreamStuff)Arrays.stream(arr);
I'm wondering if this sort of thing is even possible and if so, how do I achieve this? For reference I'm kind of using this article as a guide.