@@ -0,0 +1,1247 @@
+package com.aol.cyclops.internal.stream.spliterators;%0A%0Aimport java.util.Spliterator;%0Aimport java.util.Spliterators;%0Aimport java.util.function.Consumer;%0Aimport java.util.function.Function;%0A%0A/**%0A * Created by johnmcclean on 22/12/2016.%0A */%0Apublic class LimitSpliterator%3CT%3E extends Spliterators.AbstractSpliterator%3CT%3E %7B%0A    Spliterator%3CT%3E source;%0A    long take;%0A    long index =0;%0A    public LimitSpliterator(final Spliterator%3CT%3E source, long take) %7B%0A        super(source.estimateSize(),source.characteristics() & Spliterator.ORDERED);%0A%0A        this.source = source;%0A        this.take = take;%0A%0A    %7D%0A    @Override%0A    public void forEachRemaining(Consumer%3C? super T%3E action) %7B%0A        if(source.getExactSizeIfKnown()%3C=take) %7B%0A            source.forEachRemaining(action);%0A            return;%0A        %7D%0A        //use local index%0A        for(long index = this.index; index%3Ctake;index++)%7B%0A            source.tryAdvance(t -%3E %7B%0A%0A                action.accept(t);%0A            %7D);%0A        %7D%0A%0A    %7D%0A%0A    @Override%0A    public boolean tryAdvance(Consumer%3C? super T%3E action) %7B%0A        if(index%3Ctake) %7B%0A%0A            return source.tryAdvance(t -%3E %7B%0A                index++;%0A                action.accept(t);%0A            %7D);%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

Add limit spliterator