Use negate() instead of not() to match predicate terminology.
MODIFY
src/main/java/org/apache/commons/io/FileUtils.java
src/main/java/org/apache/commons/io/FileUtils.java
@@ -2616,7 +2616,7 @@ private static IOFileFilter setUpEffectiveDirFilter(final IOFileFilter dirFilter
* @return a filter that accepts files
*/
private static IOFileFilter setUpEffectiveFileFilter(final IOFileFilter fileFilter) {
- return fileFilter.and(DirectoryFileFilter.INSTANCE.not());
+ return fileFilter.and(DirectoryFileFilter.INSTANCE.negate());
}
/**

MODIFY
src/main/java/org/apache/commons/io/filefilter/CanExecuteFileFilter.java
src/main/java/org/apache/commons/io/filefilter/CanExecuteFileFilter.java
public static final IOFileFilter CAN_EXECUTE = new CanExecuteFileFilter();
/** Singleton instance of not <i>executable</i> filter */
- public static final IOFileFilter CANNOT_EXECUTE = CAN_EXECUTE.not();
+ public static final IOFileFilter CANNOT_EXECUTE = CAN_EXECUTE.negate();
private static final long serialVersionUID = 3179904805251622989L;

MODIFY
src/main/java/org/apache/commons/io/filefilter/CanReadFileFilter.java
src/main/java/org/apache/commons/io/filefilter/CanReadFileFilter.java
public static final IOFileFilter CAN_READ = new CanReadFileFilter();
/** Singleton instance of not <i>readable</i> filter */
- public static final IOFileFilter CANNOT_READ = CAN_READ.not();
+ public static final IOFileFilter CANNOT_READ = CAN_READ.negate();
/** Singleton instance of <i>read-only</i> filter */
public static final IOFileFilter READ_ONLY = CAN_READ.and(CanWriteFileFilter.CANNOT_WRITE);

MODIFY
src/main/java/org/apache/commons/io/filefilter/CanWriteFileFilter.java
src/main/java/org/apache/commons/io/filefilter/CanWriteFileFilter.java
public static final IOFileFilter CAN_WRITE = new CanWriteFileFilter();
/** Singleton instance of not <i>writable</i> filter */
- public static final IOFileFilter CANNOT_WRITE = CAN_WRITE.not();
+ public static final IOFileFilter CANNOT_WRITE = CAN_WRITE.negate();
private static final long serialVersionUID = 5132005214688990379L;

MODIFY
src/main/java/org/apache/commons/io/filefilter/EmptyFileFilter.java
src/main/java/org/apache/commons/io/filefilter/EmptyFileFilter.java
public static final IOFileFilter EMPTY = new EmptyFileFilter();
/** Singleton instance of <i>not-empty</i> filter */
- public static final IOFileFilter NOT_EMPTY = EMPTY.not();
+ public static final IOFileFilter NOT_EMPTY = EMPTY.negate();
private static final long serialVersionUID = 3631422087512832211L;

MODIFY
src/main/java/org/apache/commons/io/filefilter/FalseFileFilter.java
src/main/java/org/apache/commons/io/filefilter/FalseFileFilter.java
@@ -87,7 +87,7 @@ public FileVisitResult accept(final Path file, final BasicFileAttributes attribu
}
@Override
- public IOFileFilter not() {
+ public IOFileFilter negate() {
return TrueFileFilter.INSTANCE;
}

MODIFY
src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java
src/main/java/org/apache/commons/io/filefilter/FileFilterUtils.java
@@ -600,7 +600,7 @@ public static IOFileFilter nameFileFilter(final String name, final IOCase caseSe
* @see NotFileFilter
*/
public static IOFileFilter notFileFilter(final IOFileFilter filter) {
- return filter.not();
+ return filter.negate();
}
/**

MODIFY
src/main/java/org/apache/commons/io/filefilter/HiddenFileFilter.java
src/main/java/org/apache/commons/io/filefilter/HiddenFileFilter.java
private static final long serialVersionUID = 8930842316112759062L;
/** Singleton instance of <i>visible</i> filter */
- public static final IOFileFilter VISIBLE = HIDDEN.not();
+ public static final IOFileFilter VISIBLE = HIDDEN.negate();
/**
* Restrictive constructor.

MODIFY
src/main/java/org/apache/commons/io/filefilter/IOFileFilter.java
src/main/java/org/apache/commons/io/filefilter/IOFileFilter.java
@@ -93,7 +93,7 @@ default AndFileFilter and(final IOFileFilter... fileFilter) {
* @return a new filter
* @since 2.9.0
*/
- default IOFileFilter not() {
+ default IOFileFilter negate() {
return new NotFileFilter(this);
}

MODIFY
src/main/java/org/apache/commons/io/filefilter/TrueFileFilter.java
src/main/java/org/apache/commons/io/filefilter/TrueFileFilter.java
@@ -87,7 +87,7 @@ public FileVisitResult accept(final Path file, final BasicFileAttributes attribu
}
@Override
- public IOFileFilter not() {
+ public IOFileFilter negate() {
return FalseFileFilter.INSTANCE;
}

MODIFY
src/test/java/org/apache/commons/io/file/DirectoryStreamFilterTest.java
src/test/java/org/apache/commons/io/file/DirectoryStreamFilterTest.java
@@ -55,7 +55,7 @@ public void testFilterByName() throws Exception {
@Test
public void testFilterByNameNot() throws Exception {
- final PathFilter pathFilter = new NameFileFilter(PATH_FIXTURE).not();
+ final PathFilter pathFilter = new NameFileFilter(PATH_FIXTURE).negate();
final DirectoryStreamFilter streamFilter = new DirectoryStreamFilter(pathFilter);
assertEquals(pathFilter, streamFilter.getPathFilter());
try (final DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get("."), streamFilter)) {

MODIFY
src/test/java/org/apache/commons/io/filefilter/FileFilterTestCase.java
src/test/java/org/apache/commons/io/filefilter/FileFilterTestCase.java
@@ -524,8 +524,8 @@ public void testTrue() throws Exception {
assertFiltering(filter, (Path) null, true);
//
assertSame(TrueFileFilter.TRUE, TrueFileFilter.INSTANCE);
- assertSame(FalseFileFilter.FALSE, TrueFileFilter.INSTANCE.not());
- assertSame(FalseFileFilter.INSTANCE, TrueFileFilter.INSTANCE.not());
+ assertSame(FalseFileFilter.FALSE, TrueFileFilter.INSTANCE.negate());
+ assertSame(FalseFileFilter.INSTANCE, TrueFileFilter.INSTANCE.negate());
}
@Test
@@ -538,16 +538,16 @@ public void testFalse() throws Exception {
assertFiltering(filter, (File) null, false);
assertFiltering(filter, (Path) null, false);
assertSame(FalseFileFilter.FALSE, FalseFileFilter.INSTANCE);
- assertSame(TrueFileFilter.TRUE, FalseFileFilter.INSTANCE.not());
- assertSame(TrueFileFilter.INSTANCE, FalseFileFilter.INSTANCE.not());
+ assertSame(TrueFileFilter.TRUE, FalseFileFilter.INSTANCE.negate());
+ assertSame(TrueFileFilter.INSTANCE, FalseFileFilter.INSTANCE.negate());
}
@Test
- public void testNot() throws Exception {
+ public void testNegate() throws Exception {
final IOFileFilter filter = FileFilterUtils.notFileFilter(FileFilterUtils.trueFileFilter());
assertFiltering(filter, new File("foo.test"), false);
assertFiltering(filter, new File("foo"), false);
- assertFiltering(filter.not(), new File("foo"), true);
+ assertFiltering(filter.negate(), new File("foo"), true);
assertFiltering(filter, (File) null, false);
assertThrows(IllegalArgumentException.class, () -> new NotFileFilter(null));
}

Use negate() instead of not() to match predicate terminology.