Use lambdas where possible
Using the batch cleanup operation via Source -> Cleanup -> "Use lambdas where possible" from standard JDT. Change-Id: I5452bd94fdccc920ade071228aeed3a8b9fdbe62 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
This commit is contained in:
parent
4e0a409f07
commit
9d1e477417
|
@ -71,13 +71,12 @@
|
|||
*/
|
||||
public class PackFile implements Iterable<PackIndex.MutableEntry> {
|
||||
private final static Logger LOG = LoggerFactory.getLogger(PackFile.class);
|
||||
/** Sorts PackFiles to be most recently created to least recently created. */
|
||||
public static final Comparator<PackFile> SORT = new Comparator<PackFile>() {
|
||||
@Override
|
||||
public int compare(PackFile a, PackFile b) {
|
||||
return b.packLastModified.compareTo(a.packLastModified);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sorts PackFiles to be most recently created to least recently created.
|
||||
*/
|
||||
public static final Comparator<PackFile> SORT = (a, b) -> b.packLastModified
|
||||
.compareTo(a.packLastModified);
|
||||
|
||||
private final File packFile;
|
||||
|
||||
|
|
|
@ -142,23 +142,24 @@ public class PackWriter implements AutoCloseable {
|
|||
private static final Map<WeakReference<PackWriter>, Boolean> instances =
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
private static final Iterable<PackWriter> instancesIterable = new Iterable<PackWriter>() {
|
||||
@Override
|
||||
public Iterator<PackWriter> iterator() {
|
||||
return new Iterator<PackWriter>() {
|
||||
private final Iterator<WeakReference<PackWriter>> it =
|
||||
instances.keySet().iterator();
|
||||
private static final Iterable<PackWriter> instancesIterable = () -> new Iterator<PackWriter>() {
|
||||
|
||||
private final Iterator<WeakReference<PackWriter>> it = instances
|
||||
.keySet().iterator();
|
||||
|
||||
private PackWriter next;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
if (next != null)
|
||||
if (next != null) {
|
||||
return true;
|
||||
}
|
||||
while (it.hasNext()) {
|
||||
WeakReference<PackWriter> ref = it.next();
|
||||
next = ref.get();
|
||||
if (next != null)
|
||||
if (next != null) {
|
||||
return true;
|
||||
}
|
||||
it.remove();
|
||||
}
|
||||
return false;
|
||||
|
@ -179,8 +180,6 @@ public void remove() {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get all allocated, non-released PackWriters instances.
|
||||
|
|
Loading…
Reference in New Issue