Path path = new File("./folder").toPath(); WatchService watchService = FileSystems.getDefault().newWatchService(); path.register(watchService, StandardWatchEventKinds.ENTRY_CREATE); for (;;) { try { WatchKey key = watchService.take(); for (WatchEvent<?> event : key.pollEvents()) { WatchEvent.Kind<?> kind = event.kind(); if (kind.equals(StandardWatchEventKinds.ENTRY_CREATE)) { System.out.println("file created"); } } } catch (InterruptedException x) { return; } }
public boolean equals(Object o){ if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; TypeDefFluentImpl that = (TypeDefFluentImpl) o; if (kind != null ? !kind.equals(that.kind) :that.kind != null) return false; if (packageName != null ? !packageName.equals(that.packageName) :that.packageName != null) return false; if (name != null ? !name.equals(that.name) :that.name != null) return false; if (comments != null ? !comments.equals(that.comments) :that.comments != null) return false; if (annotations != null ? !annotations.equals(that.annotations) :that.annotations != null) return false; if (extendsList != null ? !extendsList.equals(that.extendsList) :that.extendsList != null) return false; if (implementsList != null ? !implementsList.equals(that.implementsList) :that.implementsList != null) return false; if (parameters != null ? !parameters.equals(that.parameters) :that.parameters != null) return false; if (properties != null ? !properties.equals(that.properties) :that.properties != null) return false; if (constructors != null ? !constructors.equals(that.constructors) :that.constructors != null) return false; if (methods != null ? !methods.equals(that.methods) :that.methods != null) return false; if (outerType != null ? !outerType.equals(that.outerType) :that.outerType != null) return false; if (innerTypes != null ? !innerTypes.equals(that.innerTypes) :that.innerTypes != null) return false; return true; }