Java Code Examples for java.util.Spliterator#ORDERED
The following examples show how to use
java.util.Spliterator#ORDERED .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DoubleStream.java From Bytecoder with Apache License 2.0 | 6 votes |
/** * Returns an infinite sequential ordered {@code DoubleStream} produced by iterative * application of a function {@code f} to an initial element {@code seed}, * producing a {@code Stream} consisting of {@code seed}, {@code f(seed)}, * {@code f(f(seed))}, etc. * * <p>The first element (position {@code 0}) in the {@code DoubleStream} * will be the provided {@code seed}. For {@code n > 0}, the element at * position {@code n}, will be the result of applying the function {@code f} * to the element at position {@code n - 1}. * * <p>The action of applying {@code f} for one element * <a href="../concurrent/package-summary.html#MemoryVisibility"><i>happens-before</i></a> * the action of applying {@code f} for subsequent elements. For any given * element the action may be performed in whatever thread the library * chooses. * * @param seed the initial element * @param f a function to be applied to the previous element to produce * a new element * @return a new sequential {@code DoubleStream} */ public static DoubleStream iterate(final double seed, final DoubleUnaryOperator f) { Objects.requireNonNull(f); Spliterator.OfDouble spliterator = new Spliterators.AbstractDoubleSpliterator(Long.MAX_VALUE, Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL) { double prev; boolean started; @Override public boolean tryAdvance(DoubleConsumer action) { Objects.requireNonNull(action); double t; if (started) t = f.applyAsDouble(prev); else { t = seed; started = true; } action.accept(prev = t); return true; } }; return StreamSupport.doubleStream(spliterator, false); }
Example 2
Source File: TestData.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public static OfInt ofNode(String name, Node.OfInt node) { int characteristics = Spliterator.SIZED | Spliterator.ORDERED; return new AbstractTestData.IntTestData<>(name, node, n -> StreamSupport.intStream(n::spliterator, characteristics, false), n -> StreamSupport.intStream(n::spliterator, characteristics, true), Node.OfInt::spliterator, n -> (int) n.count()); }
Example 3
Source File: StringLatin1.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
CharsSpliterator(byte[] array, int origin, int fence, int acs) { this.array = array; this.index = origin; this.fence = fence; this.cs = acs | Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED; }
Example 4
Source File: TestData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static OfInt ofNode(String name, Node.OfInt node) { int characteristics = Spliterator.SIZED | Spliterator.ORDERED; return new AbstractTestData.IntTestData<>(name, node, n -> StreamSupport.intStream(n::spliterator, characteristics, false), n -> StreamSupport.intStream(n::spliterator, characteristics, true), Node.OfInt::spliterator, n -> (int) n.count()); }
Example 5
Source File: ZipFile.java From Bytecoder with Apache License 2.0 | 5 votes |
EntrySpliterator(int index, int fence, IntFunction<T> gen) { super((long)fence, Spliterator.ORDERED | Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL); this.index = index; this.fence = fence; this.gen = gen; }
Example 6
Source File: TestData.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public static OfInt ofNode(String name, Node.OfInt node) { int characteristics = Spliterator.SIZED | Spliterator.ORDERED; return new AbstractTestData.IntTestData<>(name, node, n -> StreamSupport.intStream(n::spliterator, characteristics, false), n -> StreamSupport.intStream(n::spliterator, characteristics, true), Node.OfInt::spliterator, n -> (int) n.count()); }
Example 7
Source File: Streams.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public int characteristics() { return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.DISTINCT | Spliterator.SORTED; }
Example 8
Source File: ConcurrentLinkedQueue.java From Bytecoder with Apache License 2.0 | 4 votes |
public int characteristics() { return (Spliterator.ORDERED | Spliterator.NONNULL | Spliterator.CONCURRENT); }
Example 9
Source File: ConcurrentSkipListMap.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public int characteristics() { return Spliterator.DISTINCT | Spliterator.ORDERED | Spliterator.SORTED; }
Example 10
Source File: LinkedTransferQueue.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
public int characteristics() { return Spliterator.ORDERED | Spliterator.NONNULL | Spliterator.CONCURRENT; }
Example 11
Source File: StreamSpliterators.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public final int characteristics() { return s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.ORDERED); }
Example 12
Source File: StringUTF16.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
CodePointsSpliterator(byte[] array, int origin, int fence, int acs) { this.array = array; this.index = origin; this.fence = fence; this.cs = acs | Spliterator.ORDERED; }
Example 13
Source File: ConcurrentSkipListMap.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public int characteristics() { return Spliterator.DISTINCT | Spliterator.SORTED | Spliterator.ORDERED | Spliterator.CONCURRENT | Spliterator.NONNULL; }
Example 14
Source File: StreamSpliterators.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public final int characteristics() { return s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.ORDERED); }
Example 15
Source File: LinkedBlockingDeque.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public int characteristics() { return Spliterator.ORDERED | Spliterator.NONNULL | Spliterator.CONCURRENT; }
Example 16
Source File: ConcurrentLinkedQueue.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public int characteristics() { return Spliterator.ORDERED | Spliterator.NONNULL | Spliterator.CONCURRENT; }
Example 17
Source File: LinkedBlockingQueue.java From Bytecoder with Apache License 2.0 | 4 votes |
public int characteristics() { return (Spliterator.ORDERED | Spliterator.NONNULL | Spliterator.CONCURRENT); }
Example 18
Source File: FastConcurrentDirectDeque.java From lams with GNU General Public License v2.0 | 4 votes |
public int characteristics() { return Spliterator.ORDERED | Spliterator.NONNULL | Spliterator.CONCURRENT; }
Example 19
Source File: StreamSpliterators.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Override public int characteristics() { return (s.characteristics() & ~(Spliterator.SIZED | Spliterator.SUBSIZED | Spliterator.SORTED | Spliterator.ORDERED)) | Spliterator.DISTINCT; }
Example 20
Source File: LinkedBlockingDeque.java From Bytecoder with Apache License 2.0 | 4 votes |
public int characteristics() { return (Spliterator.ORDERED | Spliterator.NONNULL | Spliterator.CONCURRENT); }