From bbe93aec4f0289b2840cc69831c06e599b990fbe Mon Sep 17 00:00:00 2001 From: Michal Kordas Date: Tue, 18 Aug 2015 21:57:31 +0200 Subject: [PATCH] Replace Arrays.asList() with Collections.emptyList(). #1555 Fixes `ArraysAsListWithZeroOrOneArgument` inspection violations in test code. Description: >Reports any calls to Arrays.asList() with zero arguments or only one argument. Such calls could be replaced with either a call to Collections.singletonList() or Collections.emptyList() which will save some memory. --- .../puppycrawl/tools/checkstyle/api/FileContentsTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/puppycrawl/tools/checkstyle/api/FileContentsTest.java b/src/test/java/com/puppycrawl/tools/checkstyle/api/FileContentsTest.java index 1c1b52230..9699bc979 100644 --- a/src/test/java/com/puppycrawl/tools/checkstyle/api/FileContentsTest.java +++ b/src/test/java/com/puppycrawl/tools/checkstyle/api/FileContentsTest.java @@ -23,7 +23,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.File; -import java.util.Arrays; +import java.util.Collections; import org.junit.Test; @@ -41,7 +41,7 @@ public class FileContentsTest { public void testCppCommentNotIntersect() { // just to make UT coverage 100% FileContents o = new FileContents( - FileText.fromLines(new File("filename"), Arrays.asList(" // "))); + FileText.fromLines(new File("filename"), Collections.singletonList(" // "))); o.reportCppComment(1, 2); assertFalse(o.hasIntersectionWithComment(1, 0, 1, 1)); } @@ -50,7 +50,7 @@ public class FileContentsTest { public void testCppCommentIntersect() { // just to make UT coverage 100% FileContents o = new FileContents( - FileText.fromLines(new File("filename"), Arrays.asList(" // "))); + FileText.fromLines(new File("filename"), Collections.singletonList(" // "))); o.reportCppComment(1, 2); assertTrue(o.hasIntersectionWithComment(1, 5, 1, 6));