I've:
List<WatchEvent.Kind<Path>> events_kinds = new ArrayList<>(); events_kinds.add(StandardWatchEventKinds.ENTRY_DELETE); events_kinds.add(StandardWatchEventKinds.ENTRY_CREATE); events_kinds.add(StandardWatchEventKinds.ENTRY_MODIFY); than I want to use the register method that accepts as second arguments a Kinds<?>[] type and so I do:
WatchKey key = path.register(watch_service, (WatchEvent.Kind<Path>[]) events_kinds.toArray()); but when I execute the code I have the following exception:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.nio.file.WatchEvent$Kind; Now how can I get a Kinds<?>[] array from that list?
Thanks.