kleine Änderungen

This commit is contained in:
Johannes Theiner 2018-05-31 09:45:43 +02:00
parent d3459a5077
commit 2dd8cc4f39
2 changed files with 11 additions and 29 deletions

View File

@ -48,35 +48,17 @@ public class KlausurenServer {
ConcurrentMap<String, TreeSet<Integer>> set = new ConcurrentHashMap<>(data);
Set<TreeSet<Integer>> result = new HashSet<>();
set.forEach((key, value) -> {
set.forEach((s, integers) -> {
if(!value.equals(integers)) {
if (integers.containsAll(value)) {
set.remove(key);
}
set.forEach((key, value) -> set.forEach((s, integers) -> {
if(!value.equals(integers)) {
if (integers.containsAll(value)) {
set.remove(key);
}
});
});
set.forEach((key, value) -> {
result.add(value);
});
/*
data.forEach((key, value) -> {
result.forEach(integers -> {
if(!integers.containsAll(value)) {
result.add(integers);
}
});
});
*/
Iterator<TreeSet<Integer>> iterator = result.iterator();
while (iterator.hasNext()) {
if(iterator.next().isEmpty()) {
iterator.remove();
}
}
}));
set.forEach((key, value) -> result.add(value));
result.removeIf(TreeSet::isEmpty);
writer.write(result.toString().substring(1, result.toString().length()-1).replace(" ", ""));
} else {
@ -138,7 +120,7 @@ public class KlausurenServer {
} catch (FileNotFoundException e) {
e.printStackTrace();
}
try (BufferedReader br = new BufferedReader(fileReader)) {
try (BufferedReader br = new BufferedReader(Objects.requireNonNull(fileReader))) {
for (String line = br.readLine(); line != null; line = br.readLine()) {
TreeSet<Integer> set = new TreeSet<>();
String[] array = line.split(":");

View File

@ -1,4 +1,4 @@
A1:Relativitätstheorie:Einstein:15
A1:Relativitätstheorie:Einstein:15
B2:Quantenmechanik:Heisenberg:17
C2:Quantenphysik:Planck:5
T4:Thermodynamik:Kelvin:78