diff --git a/src/main/java/org/cactoos/func/BiFuncOf.java b/src/main/java/org/cactoos/func/BiFuncOf.java index 5f55bc275..c9266bde8 100644 --- a/src/main/java/org/cactoos/func/BiFuncOf.java +++ b/src/main/java/org/cactoos/func/BiFuncOf.java @@ -91,9 +91,7 @@ public BiFuncOf(final BiProc proc, final Z result) { */ public BiFuncOf(final BiFunc fnc) { super( - (first, second) -> { - return fnc.apply(first, second); - } + fnc::apply ); } } diff --git a/src/main/java/org/cactoos/io/Joined.java b/src/main/java/org/cactoos/io/Joined.java index 1aa7de201..875ef4995 100644 --- a/src/main/java/org/cactoos/io/Joined.java +++ b/src/main/java/org/cactoos/io/Joined.java @@ -65,9 +65,9 @@ public Joined(final Input first, final Input... rest) { @Override public InputStream stream() throws Exception { return new Reduced( - (left, right) -> new SequenceInputStream(left, right), + SequenceInputStream::new, new Mapped<>( - input -> () -> input.stream(), + input -> input::stream, this.inputs ) ).value(); diff --git a/src/main/java/org/cactoos/scalar/CallableOf.java b/src/main/java/org/cactoos/scalar/CallableOf.java index d8f25c739..60a720989 100644 --- a/src/main/java/org/cactoos/scalar/CallableOf.java +++ b/src/main/java/org/cactoos/scalar/CallableOf.java @@ -50,6 +50,6 @@ public final class CallableOf extends CallableEnvelope { * @since 0.41 */ public CallableOf(final Scalar slr) { - super(() -> slr.value()); + super(slr::value); } } diff --git a/src/main/java/org/cactoos/text/Trimmed.java b/src/main/java/org/cactoos/text/Trimmed.java index c77a94f45..c3126f5cf 100644 --- a/src/main/java/org/cactoos/text/Trimmed.java +++ b/src/main/java/org/cactoos/text/Trimmed.java @@ -40,6 +40,6 @@ public final class Trimmed extends TextEnvelope { * @param text The text */ public Trimmed(final Text text) { - super(new Mapped(str -> str.trim(), text)); + super(new Mapped(String::trim, text)); } } diff --git a/src/test/java/org/cactoos/func/BiFuncOfTest.java b/src/test/java/org/cactoos/func/BiFuncOfTest.java index 6c41f69aa..4b358f917 100644 --- a/src/test/java/org/cactoos/func/BiFuncOfTest.java +++ b/src/test/java/org/cactoos/func/BiFuncOfTest.java @@ -66,9 +66,7 @@ void convertsProcIntoBiFunc() throws Exception { "Must convert procedure into bi-function", new BiFuncOf<>( new ProcOf<>( - input -> { - done.set(input); - } + done::set ), result ), diff --git a/src/test/java/org/cactoos/func/FlattenedTest.java b/src/test/java/org/cactoos/func/FlattenedTest.java index 0616403c2..defe75190 100644 --- a/src/test/java/org/cactoos/func/FlattenedTest.java +++ b/src/test/java/org/cactoos/func/FlattenedTest.java @@ -39,7 +39,7 @@ void flattens() { new Assertion<>( "must flatten", new Flattened<>( - new FuncOf<>(x -> new BoolOf(x)) + new FuncOf<>(BoolOf::new) ), new IsApplicable<>("true", true) ).affirm(); diff --git a/src/test/java/org/cactoos/func/FuncOfTest.java b/src/test/java/org/cactoos/func/FuncOfTest.java index 60bbdae1a..7b13ffb14 100644 --- a/src/test/java/org/cactoos/func/FuncOfTest.java +++ b/src/test/java/org/cactoos/func/FuncOfTest.java @@ -44,9 +44,7 @@ void convertsProcIntoFunc() throws Exception { "Must convert Proc into Func", new FuncOf<>( new ProcOf<>( - input -> { - done.set(input); - } + done::set ), result ), diff --git a/src/test/java/org/cactoos/io/LoggingInputStreamTest.java b/src/test/java/org/cactoos/io/LoggingInputStreamTest.java index 62753cd60..cb9baf75a 100644 --- a/src/test/java/org/cactoos/io/LoggingInputStreamTest.java +++ b/src/test/java/org/cactoos/io/LoggingInputStreamTest.java @@ -53,7 +53,7 @@ public int read() throws IOException { ); new Assertion<>( "Read doesn't throw an the exception.", - () -> stream.read(), + stream::read, new Throws<>(message, IOException.class) ).affirm(); } diff --git a/src/test/java/org/cactoos/io/LoggingOutputTest.java b/src/test/java/org/cactoos/io/LoggingOutputTest.java index 6f3e60c9a..6b36c7889 100644 --- a/src/test/java/org/cactoos/io/LoggingOutputTest.java +++ b/src/test/java/org/cactoos/io/LoggingOutputTest.java @@ -65,7 +65,7 @@ public void logWriteZero() throws Exception { new TeeInput( new InputOf(""), new LoggingOutput( - () -> new ByteArrayOutputStream(), + ByteArrayOutputStream::new, "memory", logger ) diff --git a/src/test/java/org/cactoos/iterator/PagedTest.java b/src/test/java/org/cactoos/iterator/PagedTest.java index 22d894bef..08bb5ae0d 100644 --- a/src/test/java/org/cactoos/iterator/PagedTest.java +++ b/src/test/java/org/cactoos/iterator/PagedTest.java @@ -73,7 +73,7 @@ void containAllPagedContentInOrder() throws Exception { return true; }, new Matched<>( - (x, y) -> x.equals(y), + String::equals, paged, new IteratorOf<>("one", "two", "three", "four", "five") ) @@ -101,8 +101,8 @@ void reportTotalPagedLength() { final Paged paged = new Paged<>( pages.next(), page -> new Ternary<>( - () -> pages.hasNext(), - () -> pages.next(), + pages::hasNext, + pages::next, () -> new IteratorOf() ).value() ); @@ -128,8 +128,8 @@ void throwsNoSuchElement() { () -> new Paged<>( pages.next(), page -> new Ternary<>( - () -> pages.hasNext(), - () -> pages.next(), + pages::hasNext, + pages::next, () -> new IteratorOf() ).value() ).next() diff --git a/src/test/java/org/cactoos/list/NoNullsTest.java b/src/test/java/org/cactoos/list/NoNullsTest.java index f007964c2..c6ce16269 100644 --- a/src/test/java/org/cactoos/list/NoNullsTest.java +++ b/src/test/java/org/cactoos/list/NoNullsTest.java @@ -135,7 +135,7 @@ void getThrowsErrorIfListIteratorPreviousValueIsNullValue() { list.set(0, null); new Assertion<>( "must throw error if previous value in iterator is null", - () -> listiterator.previous(), + listiterator::previous, new Throws<>( "Previous item is NULL", IllegalStateException.class diff --git a/src/test/java/org/cactoos/proc/BiProcOfTest.java b/src/test/java/org/cactoos/proc/BiProcOfTest.java index dd29ea176..df9bbd5a2 100644 --- a/src/test/java/org/cactoos/proc/BiProcOfTest.java +++ b/src/test/java/org/cactoos/proc/BiProcOfTest.java @@ -88,9 +88,7 @@ void worksWithProc() throws Exception { "Must execute BiProc with Proc", new BiProcOf<>( new ProcOf<>( - input -> { - done.set(input); - } + done::set ) ), new Satisfies<>( diff --git a/src/test/java/org/cactoos/proc/ProcOfTest.java b/src/test/java/org/cactoos/proc/ProcOfTest.java index 7cd7bb137..66d813d9e 100644 --- a/src/test/java/org/cactoos/proc/ProcOfTest.java +++ b/src/test/java/org/cactoos/proc/ProcOfTest.java @@ -64,9 +64,7 @@ void worksWithLambda() throws Exception { new Assertion<>( "Must execute Proc with Lambda", new ProcOf<>( - input -> { - done.set(input); - } + done::set ), new Satisfies<>( proc -> { diff --git a/src/test/java/org/cactoos/proc/RunnableOfTest.java b/src/test/java/org/cactoos/proc/RunnableOfTest.java index d21ea260a..aea4dda5e 100644 --- a/src/test/java/org/cactoos/proc/RunnableOfTest.java +++ b/src/test/java/org/cactoos/proc/RunnableOfTest.java @@ -44,9 +44,7 @@ void convertsProcIntoRunnable() { "Must execute Runnable with Proc", new RunnableOf( new ProcOf<>( - input -> { - done.set(input); - } + done::set ), obj ), diff --git a/src/test/java/org/cactoos/scalar/FoldedTest.java b/src/test/java/org/cactoos/scalar/FoldedTest.java index 17b20e3bd..0733d0feb 100644 --- a/src/test/java/org/cactoos/scalar/FoldedTest.java +++ b/src/test/java/org/cactoos/scalar/FoldedTest.java @@ -43,7 +43,7 @@ void skipIterable() throws Exception { new Assertion<>( "Must fold elements in iterable", new Folded<>( - 0L, (first, second) -> first + second, + 0L, Long::sum, new HeadOf<>( 10, new RangeOf<>(0L, Long.MAX_VALUE, value -> ++value) diff --git a/src/test/java/org/cactoos/scalar/RepeatedTest.java b/src/test/java/org/cactoos/scalar/RepeatedTest.java index d1869c4d4..7f7daf357 100644 --- a/src/test/java/org/cactoos/scalar/RepeatedTest.java +++ b/src/test/java/org/cactoos/scalar/RepeatedTest.java @@ -44,7 +44,7 @@ void runsMultipleTimes() throws Exception { new Assertion<>( "Must run scalar 3 times", new Repeated<>( - () -> atom.incrementAndGet(), + atom::incrementAndGet, 3 ).value(), new IsEqual<>(3) diff --git a/src/test/java/org/cactoos/scalar/ScalarOfTest.java b/src/test/java/org/cactoos/scalar/ScalarOfTest.java index 4e470555e..aad17ee53 100644 --- a/src/test/java/org/cactoos/scalar/ScalarOfTest.java +++ b/src/test/java/org/cactoos/scalar/ScalarOfTest.java @@ -93,9 +93,7 @@ void worksWithProc() { "Must convert Proc into Scalar", new ScalarOf<>( new ProcOf<>( - input -> { - done.set(input); - } + done::set ), ipt, result