import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
-import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
throws IOException {
checkCancelled();
File tmpPack = null;
- Map<PackExt, File> tmpExts = new TreeMap<>(
- new Comparator<PackExt>() {
- @Override
- public int compare(PackExt o1, PackExt o2) {
- // INDEX entries must be returned last, so the pack
- // scanner does pick up the new pack until all the
- // PackExt entries have been written.
- if (o1 == o2)
- return 0;
- if (o1 == PackExt.INDEX)
- return 1;
- if (o2 == PackExt.INDEX)
- return -1;
- return Integer.signum(o1.hashCode() - o2.hashCode());
- }
-
- });
+ Map<PackExt, File> tmpExts = new TreeMap<>((o1, o2) -> {
+ // INDEX entries must be returned last, so the pack
+ // scanner does pick up the new pack until all the
+ // PackExt entries have been written.
+ if (o1 == o2) {
+ return 0;
+ }
+ if (o1 == PackExt.INDEX) {
+ return 1;
+ }
+ if (o2 == PackExt.INDEX) {
+ return -1;
+ }
+ return Integer.signum(o1.hashCode() - o2.hashCode());
+ });
try (PackWriter pw = new PackWriter(
(pconfig == null) ? new PackConfig(repo) : pconfig,
repo.newObjectReader())) {
if (!Files.exists(dir)) {
return false;
}
- try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir,
- new DirectoryStream.Filter<Path>() {
-
- @Override
- public boolean accept(Path file) throws IOException {
- Path fileName = file.getFileName();
- return Files.isRegularFile(file) && fileName != null
- && PATTERN_LOOSE_OBJECT
- .matcher(fileName.toString()).matches();
- }
+ try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, file -> {
+ Path fileName = file.getFileName();
+ return Files.isRegularFile(file) && fileName != null
+ && PATTERN_LOOSE_OBJECT.matcher(fileName.toString())
+ .matches();
})) {
- for (Iterator<Path> iter = stream.iterator(); iter.hasNext();
- iter.next()) {
+ for (Iterator<Path> iter = stream.iterator(); iter.hasNext(); iter
+ .next()) {
if (++n > threshold) {
return true;
}