All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.util.Spliterator Maven / Gradle / Ivy

Go to download

JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.

The newest version!
package java.util;

import java.util.function.Consumer;
import java.util.function.DoubleConsumer;
import java.util.function.IntConsumer;
import java.util.function.LongConsumer;

public interface Spliterator {
	int ORDERED = 0x00000010;
	int DISTINCT = 0x00000001;
	int SORTED = 0x00000004;
	int SIZED = 0x00000040;
	int NONNULL = 0x00000100;
	int IMMUTABLE = 0x00000400;
	int CONCURRENT = 0x00001000;
	int SUBSIZED = 0x00004000;

	boolean tryAdvance(Consumer action);

	default void forEachRemaining(Consumer action) {
		do {
		} while (tryAdvance(action));
	}

	Spliterator trySplit();

	long estimateSize();

	default long getExactSizeIfKnown() {
		return (characteristics() & SIZED) == 0 ? -1L : estimateSize();
	}

	int characteristics();

	default boolean hasCharacteristics(int characteristics) {
		return (characteristics() & characteristics) == characteristics;
	}

	default Comparator getComparator() {
		throw new IllegalStateException();
	}

	interface OfPrimitive> extends Spliterator {
		@Override
		T_SPLITR trySplit();

		@SuppressWarnings("overloads")
		boolean tryAdvance(T_CONS action);

		@SuppressWarnings("overloads")
		default void forEachRemaining(T_CONS action) {
			do {
			} while (tryAdvance(action));
		}
	}

	interface OfInt extends OfPrimitive {

		@Override
		OfInt trySplit();

		@Override
		boolean tryAdvance(IntConsumer action);

		@Override
		default void forEachRemaining(IntConsumer action) {
			do {
			} while (tryAdvance(action));
		}

		@Override
		default boolean tryAdvance(Consumer action) {
			throw new RuntimeException("Not implemented");

		}

		@Override
		default void forEachRemaining(Consumer action) {
			throw new RuntimeException("Not implemented");

		}
	}

	interface OfLong extends OfPrimitive {

		@Override
		OfLong trySplit();

		@Override
		boolean tryAdvance(LongConsumer action);

		@Override
		default void forEachRemaining(LongConsumer action) {
			do {
			} while (tryAdvance(action));
		}

		@Override
		default boolean tryAdvance(Consumer action) {
			throw new RuntimeException("Not implemented");

		}

		@Override
		default void forEachRemaining(Consumer action) {
			throw new RuntimeException("Not implemented");

		}
	}

	interface OfDouble extends OfPrimitive {

		@Override
		OfDouble trySplit();

		@Override
		boolean tryAdvance(DoubleConsumer action);

		@Override
		default void forEachRemaining(DoubleConsumer action) {
			do {
			} while (tryAdvance(action));
		}

		@Override
		default boolean tryAdvance(Consumer action) {
			throw new RuntimeException("Not implemented");
		}

		@Override
		default void forEachRemaining(Consumer action) {
			throw new RuntimeException("Not implemented");
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy