Skip to content

Commit

Permalink
8317034: Remove redundant type cast in the java.util.stream package
Browse files Browse the repository at this point in the history
Reviewed-by: psandoz
  • Loading branch information
mabbay authored and Paul Sandoz committed Oct 2, 2023
1 parent d7d1d42 commit ad81abd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public void accept(double t) {
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
Expand Down Expand Up @@ -422,7 +422,7 @@ public final DoubleStream sorted() {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public final LongStream sorted() {
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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -307,7 +307,7 @@ public void forEachRemaining(Consumer<? super P_OUT> consumer) {
Objects.requireNonNull(consumer);
init();

ph.wrapAndCopyInto((Sink<P_OUT>) consumer::accept, spliterator);
ph.wrapAndCopyInto(consumer::accept, spliterator);
finished = true;
}
else {
Expand Down

1 comment on commit ad81abd

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.