java.util.function.DoubleToLongFunction Java Examples

The following examples show how to use java.util.function.DoubleToLongFunction. 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 Project: jdk1.8-source-analysis   Author: raysonfang   File: DoublePipeline.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #2
Source Project: dragonwell8_jdk   Author: alibaba   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #3
Source Project: TencentKona-8   Author: Tencent   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #4
Source Project: jdk8u60   Author: chenghanpeng   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #5
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: DoublePipeline.java    License: MIT License 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #6
Source Project: desugar_jdk_libs   Author: google   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #7
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #8
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #9
Source Project: Bytecoder   Author: mirkosertic   File: DoublePipeline.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #10
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #11
Source Project: jdk8u-jdk   Author: lambdalab-mirror   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #12
Source Project: Java8CN   Author: Java8-CNAPI-Team   File: DoublePipeline.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #13
Source Project: hottub   Author: dsrg-uoft   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #14
Source Project: openjdk-8-source   Author: keerath   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #15
Source Project: openjdk-8   Author: bpupadhyaya   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #16
Source Project: jdk8u_jdk   Author: JetBrains   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #17
Source Project: jdk8u-jdk   Author: frohoff   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #18
Source Project: jdk8u-dev-jdk   Author: frohoff   File: DoublePipeline.java    License: GNU General Public License v2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #19
Source Project: j2objc   Author: google   File: DoublePipeline.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public final LongStream mapToLong(DoubleToLongFunction mapper) {
    Objects.requireNonNull(mapper);
    return new LongPipeline.StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                                StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT) {
        @Override
        public Sink<Double> opWrapSink(int flags, Sink<Long> sink) {
            return new Sink.ChainedDouble<Long>(sink) {
                @Override
                public void accept(double t) {
                    downstream.accept(mapper.applyAsLong(t));
                }
            };
        }
    };
}
 
Example #20
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: DefaultMethodStreams.java    License: GNU General Public License v2.0 4 votes vote down vote up
@Override
public LongStream mapToLong(DoubleToLongFunction mapper) {
    return s.mapToLong(mapper);
}
 
Example #21
Source Project: streamex   Author: amaembo   File: DoubleStreamEx.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public LongStreamEx mapToLong(DoubleToLongFunction mapper) {
    return new LongStreamEx(stream().mapToLong(mapper), context);
}
 
Example #22
Source Project: streamex   Author: amaembo   File: DoubleStreamEx.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Returns the minimum element of this stream according to the provided key
 * extractor function.
 *
 * <p>
 * This is a terminal operation.
 *
 * @param keyExtractor a non-interfering, stateless function
 * @return an {@code OptionalDouble} describing the first element of this
 *         stream for which the lowest value was returned by key extractor,
 *         or an empty {@code OptionalDouble} if the stream is empty
 * @since 0.1.2
 */
public OptionalDouble minByLong(DoubleToLongFunction keyExtractor) {
    return collect(PrimitiveBox::new, (box, d) -> {
        long key = keyExtractor.applyAsLong(d);
        if (!box.b || box.l > key) {
            box.b = true;
            box.l = key;
            box.d = d;
        }
    }, PrimitiveBox.MIN_LONG).asDouble();
}
 
Example #23
Source Project: streamex   Author: amaembo   File: DoubleStreamEx.java    License: Apache License 2.0 3 votes vote down vote up
/**
 * Returns the maximum element of this stream according to the provided key
 * extractor function.
 *
 * <p>
 * This is a terminal operation.
 *
 * @param keyExtractor a non-interfering, stateless function
 * @return an {@code OptionalDouble} describing the first element of this
 *         stream for which the highest value was returned by key extractor,
 *         or an empty {@code OptionalDouble} if the stream is empty
 * @since 0.1.2
 */
public OptionalDouble maxByLong(DoubleToLongFunction keyExtractor) {
    return collect(PrimitiveBox::new, (box, d) -> {
        long key = keyExtractor.applyAsLong(d);
        if (!box.b || box.l < key) {
            box.b = true;
            box.l = key;
            box.d = d;
        }
    }, PrimitiveBox.MAX_LONG).asDouble();
}
 
Example #24
Source Project: jdk1.8-source-analysis   Author: raysonfang   File: DoubleStream.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Returns a {@code LongStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
LongStream mapToLong(DoubleToLongFunction mapper);
 
Example #25
Source Project: dragonwell8_jdk   Author: alibaba   File: DoubleStream.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@code LongStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
LongStream mapToLong(DoubleToLongFunction mapper);
 
Example #26
Source Project: TencentKona-8   Author: Tencent   File: DoubleStream.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@code LongStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
LongStream mapToLong(DoubleToLongFunction mapper);
 
Example #27
Source Project: jdk8u60   Author: chenghanpeng   File: DoubleStream.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@code LongStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
LongStream mapToLong(DoubleToLongFunction mapper);
 
Example #28
Source Project: JDKSourceCode1.8   Author: wupeixuan   File: DoubleStream.java    License: MIT License 2 votes vote down vote up
/**
 * Returns a {@code LongStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
LongStream mapToLong(DoubleToLongFunction mapper);
 
Example #29
Source Project: desugar_jdk_libs   Author: google   File: DoubleStream.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@code LongStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
LongStream mapToLong(DoubleToLongFunction mapper);
 
Example #30
Source Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: DoubleStream.java    License: GNU General Public License v2.0 2 votes vote down vote up
/**
 * Returns a {@code LongStream} consisting of the results of applying the
 * given function to the elements of this stream.
 *
 * <p>This is an <a href="package-summary.html#StreamOps">intermediate
 * operation</a>.
 *
 * @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
 *               <a href="package-summary.html#Statelessness">stateless</a>
 *               function to apply to each element
 * @return the new stream
 */
LongStream mapToLong(DoubleToLongFunction mapper);