Remove trailing white spaces on all lines.
More lambdas, less boilerplate.
MODIFY
src/main/java/org/apache/commons/io/input/BOMInputStream.java
src/main/java/org/apache/commons/io/input/BOMInputStream.java
@@ -137,10 +137,7 @@ public BOMInputStream(final InputStream delegate, final ByteOrderMark... boms) {
/**
* Compares ByteOrderMark objects in descending length order.
*/
- private static final Comparator<ByteOrderMark> ByteOrderMarkLengthComparator = new Comparator<ByteOrderMark>() {
-
- @Override
- public int compare(final ByteOrderMark bom1, final ByteOrderMark bom2) {
+ private static final Comparator<ByteOrderMark> ByteOrderMarkLengthComparator = (bom1, bom2) -> {
final int len1 = bom1.length();
final int len2 = bom2.length();
if (len1 > len2) {
@@ -150,7 +147,6 @@ public int compare(final ByteOrderMark bom1, final ByteOrderMark bom2) {
return 1;
}
return 0;
- }
};
/**

MODIFY
src/test/java/org/apache/commons/io/FileUtilsWaitForTestCase.java
src/test/java/org/apache/commons/io/FileUtilsWaitForTestCase.java
@@ -44,13 +44,10 @@ public void testWaitFor() {
public void testWaitForInterrupted() throws InterruptedException {
final AtomicBoolean wasInterrupted = new AtomicBoolean(false);
final CountDownLatch started = new CountDownLatch(1);
- final Runnable thread = new Runnable() {
- @Override
- public void run() {
+ final Runnable thread = () -> {
started.countDown();
FileUtils.waitFor(new File(""), 2);
wasInterrupted.set( Thread.currentThread().isInterrupted());
- }
};
final Thread thread1 = new Thread(thread);
thread1.start();

MODIFY
src/test/java/org/apache/commons/io/IOUtilsTestCase.java
src/test/java/org/apache/commons/io/IOUtilsTestCase.java
@@ -142,21 +142,15 @@ public void setUp() {
}
@Test public void testCloseQuietly_AllCloseableIOException() {
- final Closeable closeable = new Closeable() {
- @Override
- public void close() throws IOException {
+ final Closeable closeable = () -> {
throw new IOException();
- }
};
IOUtils.closeQuietly(closeable, null, closeable);
}
@Test public void testCloseQuietly_CloseableIOException() {
- IOUtils.closeQuietly(new Closeable() {
- @Override
- public void close() throws IOException {
+ IOUtils.closeQuietly((Closeable) () -> {
throw new IOException();
- }
});
}

MODIFY
src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java
src/test/java/org/apache/commons/io/serialization/ValidatingObjectInputStreamTest.java
private MockSerializedClass testObject;
private InputStream testStream;
- static private final ClassNameMatcher ALWAYS_TRUE = new ClassNameMatcher() {
- @Override
- public boolean matches(final String className) {
- return true;
- }
- };
+ static private final ClassNameMatcher ALWAYS_TRUE = className -> true;
@Override
@Before

Remove trailing white spaces on all lines.
More lambdas, less boilerplate.