Skip to content

Commit 6c01d24

Browse files
committed
Use IntUnaryOperator
1 parent 4a298b7 commit 6c01d24

3 files changed

Lines changed: 5 additions & 59 deletions

File tree

src/changes/changes.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,6 @@ The <action> type attribute can be add,update,fix,remove.
107107
<action dev="ggregory" type="add" due-to="Gary Gregory">
108108
Add DeferredFileOutputStream.Builder.setDirectory(Path).
109109
</action>
110-
<action dev="ggregory" type="add" due-to="Gary Gregory">
111-
Add IntToIntFunction.
112-
</action>
113110
<action dev="ggregory" type="add" due-to="Gary Gregory">
114111
Add AbstractStreamBuilder.setBufferSizeChecker(IntToIntFunction).
115112
</action>

src/main/java/org/apache/commons/io/build/AbstractStreamBuilder.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
import java.nio.charset.Charset;
2525
import java.nio.file.OpenOption;
2626
import java.nio.file.Path;
27+
import java.util.function.IntUnaryOperator;
28+
2729
import org.apache.commons.io.Charsets;
2830
import org.apache.commons.io.IOUtils;
2931
import org.apache.commons.io.file.PathUtils;
30-
import org.apache.commons.io.function.IntToIntFunction;
3132

3233
/**
3334
* Abstracts building a typed instance of {@code T}.
@@ -72,12 +73,12 @@ public abstract class AbstractStreamBuilder<T, B extends AbstractStreamBuilder<T
7273
/**
7374
* The default checking behavior for a buffer size request. Throws a {@link IllegalArgumentException} by default.
7475
*/
75-
private final IntToIntFunction defaultSizeChecker = size -> size > bufferSizeMax ? throwIae(size, bufferSizeMax) : size;
76+
private final IntUnaryOperator defaultSizeChecker = size -> size > bufferSizeMax ? throwIae(size, bufferSizeMax) : size;
7677

7778
/**
7879
* The checking behavior for a buffer size request.
7980
*/
80-
private IntToIntFunction bufferSizeChecker = defaultSizeChecker;
81+
private IntUnaryOperator bufferSizeChecker = defaultSizeChecker;
8182

8283
/**
8384
* Applies the buffer size request.
@@ -233,7 +234,7 @@ public B setBufferSize(final Integer bufferSize) {
233234
* @return this
234235
* @since 2.14.0
235236
*/
236-
public B setBufferSizeChecker(final IntToIntFunction bufferSizeChecker) {
237+
public B setBufferSizeChecker(final IntUnaryOperator bufferSizeChecker) {
237238
this.bufferSizeChecker = bufferSizeChecker != null ? bufferSizeChecker : defaultSizeChecker;
238239
return asThis();
239240
}

src/main/java/org/apache/commons/io/function/IntToIntFunction.java

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)