java.util.function.IntToLongFunction Java Examples
The following examples show how to use
java.util.function.IntToLongFunction.
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: IntPipeline.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #2
Source File: IntPipeline.java From j2objc with Apache License 2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override public Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #3
Source File: IntPipeline.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #4
Source File: IntPipeline.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #5
Source File: IntPipeline.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #6
Source File: IntPipeline.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #7
Source File: CompactArrayUtil.java From ViaVersion with MIT License | 6 votes |
public static long[] createCompactArray(int bitsPerEntry, int entries, IntToLongFunction valueGetter) { long maxEntryValue = (1L << bitsPerEntry) - 1; long[] data = new long[(int) Math.ceil(entries * bitsPerEntry / 64.0)]; for (int i = 0; i < entries; i++) { long value = valueGetter.applyAsLong(i); int bitIndex = i * bitsPerEntry; int startIndex = bitIndex / 64; int endIndex = ((i + 1) * bitsPerEntry - 1) / 64; int startBitSubIndex = bitIndex % 64; data[startIndex] = data[startIndex] & ~(maxEntryValue << startBitSubIndex) | (value & maxEntryValue) << startBitSubIndex; if (startIndex != endIndex) { int endBitSubIndex = 64 - startBitSubIndex; data[endIndex] = data[endIndex] >>> endBitSubIndex << endBitSubIndex | (value & maxEntryValue) >> endBitSubIndex; } } return data; }
Example #8
Source File: CompactArrayUtil.java From ViaVersion with MIT License | 6 votes |
public static long[] createCompactArrayWithPadding(int bitsPerEntry, int entries, IntToLongFunction valueGetter) { long maxEntryValue = (1L << bitsPerEntry) - 1; char valuesPerLong = (char) (64 / bitsPerEntry); int magicIndex = 3 * (valuesPerLong - 1); long divideMul = Integer.toUnsignedLong(MAGIC[magicIndex]); long divideAdd = Integer.toUnsignedLong(MAGIC[magicIndex + 1]); int divideShift = MAGIC[magicIndex + 2]; int size = (entries + valuesPerLong - 1) / valuesPerLong; long[] data = new long[size]; for (int i = 0; i < entries; i++) { long value = valueGetter.applyAsLong(i); int cellIndex = (int) (i * divideMul + divideAdd >> 32L >> divideShift); int bitIndex = (i - cellIndex * valuesPerLong) * bitsPerEntry; data[cellIndex] = data[cellIndex] & ~(maxEntryValue << bitIndex) | (value & maxEntryValue) << bitIndex; } return data; }
Example #9
Source File: IntPipeline.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #10
Source File: IntPipeline.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #11
Source File: IntPipeline.java From Java8CN with Apache License 2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #12
Source File: IntPipeline.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #13
Source File: IntPipeline.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #14
Source File: IntPipeline.java From Bytecoder with Apache License 2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #15
Source File: IntPipeline.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #16
Source File: IntPipeline.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #17
Source File: IntPipeline.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #18
Source File: IntPipeline.java From desugar_jdk_libs with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #19
Source File: IntPipeline.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #20
Source File: IntPipeline.java From JDKSourceCode1.8 with MIT License | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #21
Source File: IntPipeline.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
@Override public final LongStream mapToLong(IntToLongFunction mapper) { Objects.requireNonNull(mapper); return new LongPipeline.StatelessOp<Integer>(this, StreamShape.INT_VALUE, StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) { @Override Sink<Integer> opWrapSink(int flags, Sink<Long> sink) { return new Sink.ChainedInt<Long>(sink) { @Override public void accept(int t) { downstream.accept(mapper.applyAsLong(t)); } }; } }; }
Example #22
Source File: SetAllTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }
Example #23
Source File: SetAllTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }
Example #24
Source File: SetAllTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }
Example #25
Source File: SetAllTest.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }
Example #26
Source File: SetAllTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }
Example #27
Source File: SetAllTest.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }
Example #28
Source File: SetAllTest.java From hottub with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }
Example #29
Source File: SetAllTest.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }
Example #30
Source File: SetAllTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Test(dataProvider = "long") public void testSetAllLong(String name, int size, IntToLongFunction generator, long[] expected) { long[] result = new long[size]; Arrays.setAll(result, generator); assertEquals(result, expected, "setAll(long[], IntToLongFunction) case " + name + " failed."); // ensure fresh array result = new long[size]; Arrays.parallelSetAll(result, generator); assertEquals(result, expected, "parallelSetAll(long[], IntToLongFunction) case " + name + " failed."); }