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 File: DoublePipeline.java    From openjdk-jdk8u-backup with 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 #2
Source File: DoublePipeline.java    From openjdk-8 with 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 File: DoublePipeline.java    From openjdk-8-source with 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 File: DoublePipeline.java    From hottub with 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 File: DoublePipeline.java    From jdk8u_jdk with 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 #6
Source File: DoublePipeline.java    From Java8CN with 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 #7
Source File: DoublePipeline.java    From jdk8u-jdk with 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 File: DoublePipeline.java    From openjdk-jdk9 with 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 File: DoublePipeline.java    From Bytecoder with 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 File: DoublePipeline.java    From openjdk-jdk8u with 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 File: DoublePipeline.java    From jdk8u-jdk with 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 File: DoublePipeline.java    From jdk1.8-source-analysis with 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 File: DoublePipeline.java    From dragonwell8_jdk with 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 File: DoublePipeline.java    From j2objc with 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 #15
Source File: DoublePipeline.java    From TencentKona-8 with 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 File: DoublePipeline.java    From JDKSourceCode1.8 with 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 #17
Source File: DoublePipeline.java    From jdk8u60 with 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 File: DoublePipeline.java    From jdk8u-dev-jdk with 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 File: DoublePipeline.java    From desugar_jdk_libs with 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 #20
Source File: DefaultMethodStreams.java    From openjdk-jdk9 with 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 File: DoubleStreamEx.java    From streamex with 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 File: DoubleStreamEx.java    From streamex with 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 File: DoubleStreamEx.java    From streamex with 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 File: DoubleStreamEx.java    From streamex with Apache License 2.0 2 votes vote down vote up
/**
 * Returns a stream consisting of the elements of this stream, sorted
 * according to the long values extracted by provided function.
 *
 * <p>
 * For ordered streams, the sort is stable. For unordered streams, no
 * stability guarantees are made.
 *
 * <p>
 * This is a <a href="package-summary.html#StreamOps">stateful intermediate
 * operation</a>.
 *
 * @param keyExtractor a
 *        <a href="package-summary.html#NonInterference">non-interfering
 *        </a>, <a href="package-summary.html#Statelessness">stateless</a>
 *        function to be used to extract sorting keys
 * @return the new stream
 */
public DoubleStreamEx sortedByLong(DoubleToLongFunction keyExtractor) {
    return sorted(Comparator.comparingLong(keyExtractor::applyAsLong));
}
 
Example #25
Source File: DoubleStream.java    From jdk8u_jdk with 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 File: DoubleStream.java    From jdk8u-dev-jdk with 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 File: DoubleStream.java    From j2objc with 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 #28
Source File: DoubleStream.java    From openjdk-8 with 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 #29
Source File: DoubleStream.java    From jdk8u-jdk with 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 File: DoubleStream.java    From openjdk-8-source with 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);