this.filter = filter;
// last modified file is first
- this.comparator = new Comparator<File>() {
-
- @Override
- public int compare(File o1, File o2) {
- return (int) (o2.lastModified() - o1.lastModified());
- }
-
- };
+ this.comparator = (o1, o2) -> (int) (o2.lastModified() - o1.lastModified());
}
public void setFilter(FileFilter filter) {
}
}
- protected Path getManifestPath(Path pluginPath) throws PluginException {
+ protected Path getManifestPath(Path pluginPath) {
if (Files.isDirectory(pluginPath)) {
// legacy (the path is something like "classes/META-INF/MANIFEST.MF")
return FileUtils.findFile(pluginPath,"MANIFEST.MF");
}
PluginWrapper other = (PluginWrapper) obj;
- if (!descriptor.getPluginId().equals(other.descriptor.getPluginId())) {
- return false;
- }
- return true;
+ return descriptor.getPluginId().equals(other.descriptor.getPluginId());
+
}
@Override
String extension = getBinaryName(extensionElement);
for (TypeElement extensionPointElement : extensionPointElements) {
String extensionPoint = getBinaryName(extensionPointElement);
- Set<String> extensionPoints = extensions.get(extensionPoint);
- if (extensionPoints == null) {
- extensionPoints = new TreeSet<>();
- extensions.put(extensionPoint, extensionPoints);
- }
+ Set<String> extensionPoints = extensions.computeIfAbsent(extensionPoint, k -> new TreeSet<>());
extensionPoints.add(extension);
}
}
import java.util.List;
/**
- * This filter providing conditional AND logic across a list of
- * file filters. This filter returns <code>true</code> if all filters in the
- * list return <code>true</code>. Otherwise, it returns <code>false</code>.
- * Checking of the file filter list stops when the first filter returns
- * <code>false</code>.
+ * This filter providing conditional AND logic across a list of file filters.
+ * This filter returns {@code true} if all filters in the list return {@code true}. Otherwise, it returns {@code false}.
+ * Checking of the file filter list stops when the first filter returns {@code false}.
*
* @author Decebal Suiu
*/
private List<FileFilter> fileFilters;
public AndFileFilter() {
- this(new ArrayList<FileFilter>());
+ this(new ArrayList<>());
}
public AndFileFilter(FileFilter... fileFilters) {
@Override
public boolean accept(File file) {
- if (this.fileFilters.size() == 0) {
+ if (this.fileFilters.isEmpty()) {
return false;
}
return;
}
- neighbors.put(vertex, new ArrayList<V>());
+ neighbors.put(vertex, new ArrayList<>());
}
/**
}
public List<V> getNeighbors(V vertex) {
- return containsVertex(vertex) ? neighbors.get(vertex) : new ArrayList<V>();
+ return containsVertex(vertex) ? neighbors.get(vertex) : new ArrayList<>();
}
/**
}
/**
- * Report (as a Map) the in-degree (the number of head ends adjacent to a vertex) of each vertex.
+ * Report (as a {@link Map}) the in-degree (the number of head ends adjacent to a vertex) of each vertex.
*/
public Map<V, Integer> inDegree() {
Map<V, Integer> result = new HashMap<>();
*/
@Override
public String toString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
for (V vertex : neighbors.keySet()) {
- sb.append("\n " + vertex + " -> " + neighbors.get(vertex));
+ sb.append("\n ").append(vertex).append(" -> ").append(neighbors.get(vertex));
}
return sb.toString();
import java.util.List;
/**
- * This filter providing conditional OR logic across a list of
- * file filters. This filter returns <code>true</code> if one filter in the
- * list return <code>true</code>. Otherwise, it returns <code>false</code>.
- * Checking of the file filter list stops when the first filter returns
- * <code>true</code>.
+ * This filter providing conditional OR logic across a list of file filters.
+ * This filter returns {@code true} if one filter in the list return {@code true}. Otherwise, it returns {@code false}.
+ * Checking of the file filter list stops when the first filter returns {@code true}.
*
* @author Decebal Suiu
*/
private List<FileFilter> fileFilters;
public OrFileFilter() {
- this(new ArrayList<FileFilter>());
+ this(new ArrayList<>());
}
public OrFileFilter(FileFilter... fileFilters) {
@Override
public boolean accept(File file) {
- if (this.fileFilters.size() == 0) {
+ if (this.fileFilters.isEmpty()) {
return true;
}