3232 */
3333public final class FileAlterationMonitor implements Runnable {
3434
35+ private static final FileAlterationObserver [] EMPTY_ARRAY = new FileAlterationObserver [0 ];
36+
3537 private final long interval ;
3638 private final List <FileAlterationObserver > observers = new CopyOnWriteArrayList <>();
3739 private Thread thread ;
@@ -49,32 +51,36 @@ public FileAlterationMonitor() {
4951 * Constructs a monitor with the specified interval.
5052 *
5153 * @param interval The amount of time in milliseconds to wait between
52- * checks of the file system
54+ * checks of the file system.
5355 */
5456 public FileAlterationMonitor (final long interval ) {
5557 this .interval = interval ;
5658 }
5759
5860 /**
59- * Wrapper constructor for {@link #FileAlterationMonitor(long, FileAlterationObserver...)}.
6061 * Constructs a monitor with the specified interval and collection of observers.
6162 *
6263 * @param interval The amount of time in milliseconds to wait between
63- * checks of the file system
64- * @param observers The collection of observers to add to the monitor
64+ * checks of the file system.
65+ * @param observers The collection of observers to add to the monitor.
66+ * @since 2.9.0
6567 */
6668 public FileAlterationMonitor (final long interval , final Collection <FileAlterationObserver > observers ) {
67- this (interval , Optional .ofNullable (observers )
69+ // @formatter:off
70+ this (interval ,
71+ Optional
72+ .ofNullable (observers )
6873 .orElse (Collections .emptyList ())
69- .toArray (new FileAlterationObserver [ 0 ] )
74+ .toArray (EMPTY_ARRAY )
7075 );
76+ // @formatter:on
7177 }
7278
7379 /**
7480 * Constructs a monitor with the specified interval and set of observers.
7581 *
7682 * @param interval The amount of time in milliseconds to wait between
77- * checks of the file system
83+ * checks of the file system.
7884 * @param observers The set of observers to add to the monitor.
7985 */
8086 public FileAlterationMonitor (final long interval , final FileAlterationObserver ... observers ) {
0 commit comments