8317034: Remove redundant type cast in the java.util.stream package

Reviewed-by: psandoz
This commit is contained in:
Mourad Abbay 2023-10-02 20:13:46 +00:00 committed by Paul Sandoz
parent d7d1d42b67
commit ad81abd2db
3 changed files with 5 additions and 5 deletions
src/java.base/share/classes/java/util/stream

@ -388,7 +388,7 @@ abstract class DoublePipeline<E_IN>
public final DoubleStream limit(long maxSize) {
if (maxSize < 0)
throw new IllegalArgumentException(Long.toString(maxSize));
return SliceOps.makeDouble(this, (long) 0, maxSize);
return SliceOps.makeDouble(this, 0L, maxSize);
}
@Override
@ -422,7 +422,7 @@ abstract class DoublePipeline<E_IN>
public final DoubleStream distinct() {
// While functional and quick to implement, this approach is not very efficient.
// An efficient version requires a double-specific map/set implementation.
return boxed().distinct().mapToDouble(i -> (double) i);
return boxed().distinct().mapToDouble(i -> i);
}
// Terminal ops from DoubleStream

@ -435,7 +435,7 @@ abstract class LongPipeline<E_IN>
public final LongStream distinct() {
// While functional and quick to implement, this approach is not very efficient.
// An efficient version requires a long-specific map/set implementation.
return boxed().distinct().mapToLong(i -> (long) i);
return boxed().distinct().mapToLong(i -> i);
}
// Terminal ops from LongStream

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -307,7 +307,7 @@ class StreamSpliterators {
Objects.requireNonNull(consumer);
init();
ph.wrapAndCopyInto((Sink<P_OUT>) consumer::accept, spliterator);
ph.wrapAndCopyInto(consumer::accept, spliterator);
finished = true;
}
else {