[NUSTitle] Simplify the getFSTEntriesFlatByContents function

This commit is contained in:
Maschell 2019-02-28 21:17:18 +01:00
parent 2f26e1d39e
commit 9b179f51a6

View File

@ -25,6 +25,7 @@ import java.util.Map.Entry;
import java.util.Optional; import java.util.Optional;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors;
import de.mas.wiiu.jnus.entities.TMD; import de.mas.wiiu.jnus.entities.TMD;
import de.mas.wiiu.jnus.entities.Ticket; import de.mas.wiiu.jnus.entities.Ticket;
@ -58,13 +59,7 @@ public class NUSTitle {
} }
public List<FSTEntry> getFSTEntriesFlatByContents(List<Content> list) { public List<FSTEntry> getFSTEntriesFlatByContents(List<Content> list) {
List<FSTEntry> entries = new ArrayList<>(); return list.stream().flatMap(c -> c.getEntries().stream()).collect(Collectors.toList());
for (Content c : list) {
for (FSTEntry f : c.getEntries()) {
entries.add(f);
}
}
return entries;
} }
public List<FSTEntry> getAllFSTEntriesFlat() { public List<FSTEntry> getAllFSTEntriesFlat() {