Browse Source

GC: Simplify lambda

filter() stream operation also accepts a lambda expression.

Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com>
Change-Id: Ie0b7fe43d39593172969fd16c3e44b49bac27306
stable-4.11
Hector Caballero 7 years ago
parent
commit
54053389ef
  1. 7
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

7
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

@ -931,11 +931,10 @@ public class GC {
List<String> fileNames = null; List<String> fileNames = null;
try (Stream<Path> files = Files.list(packDir)) { try (Stream<Path> files = Files.list(packDir)) {
fileNames = files.map(path -> path.getFileName().toString()) fileNames = files.map(path -> path.getFileName().toString())
.filter(name -> { .filter(name -> (name.endsWith(PACK_EXT)
return (name.endsWith(PACK_EXT)
|| name.endsWith(BITMAP_EXT) || name.endsWith(BITMAP_EXT)
|| name.endsWith(INDEX_EXT)); || name.endsWith(INDEX_EXT)))
}).sorted(Collections.reverseOrder()) .sorted(Collections.reverseOrder())
.collect(Collectors.toList()); .collect(Collectors.toList());
} catch (IOException e1) { } catch (IOException e1) {
// ignore // ignore

Loading…
Cancel
Save