|
24 | 24 | import java.util.List; |
25 | 25 | import java.util.Map; |
26 | 26 | import java.util.function.Function; |
27 | | -import java.util.stream.Collectors; |
28 | 27 |
|
29 | 28 | import de.learnlib.algorithm.LearningAlgorithm.MealyLearner; |
30 | 29 | import de.learnlib.counterexample.LocalSuffixFinders; |
@@ -214,8 +213,7 @@ private Word<I> pickSuffix(BitSet remRows) { |
214 | 213 | } |
215 | 214 |
|
216 | 215 | private void followNode(FringeRow<S, I, O> f, Node<S, I, O> n) { |
217 | | - if (n instanceof Leaf) { // TODO simplify when switching to newer java |
218 | | - final Leaf<S, I, O> l = (Leaf<S, I, O>) n; |
| 216 | + if (n instanceof Leaf<S, I, O> l) { |
219 | 217 | assert l.isUnsplit(); |
220 | 218 | f.leaf = l; |
221 | 219 | return; |
@@ -251,8 +249,7 @@ private void followNode(FringeRow<S, I, O> f, Node<S, I, O> n) { |
251 | 249 |
|
252 | 250 | private Word<O> query(Row<S, I, O> r, Word<I> suf) { |
253 | 251 | final Word<O> out = oracle.answerQuery(r.prefix.concat(suf)); |
254 | | - if (r instanceof FringeRow) { // TODO simplify when switching to newer java |
255 | | - final FringeRow<S, I, O> f = (FringeRow<S, I, O>) r; |
| 252 | + if (r instanceof FringeRow<S, I, O> f) { |
256 | 253 | f.transOut = out.prefix(f.prefix.length()).lastSymbol(); |
257 | 254 | } |
258 | 255 |
|
@@ -303,9 +300,8 @@ private int moveToCore(FringeRow<S, I, O> f, List<Integer> cellIds) { |
303 | 300 | * and returns a list containing the observations for all suffixes. |
304 | 301 | */ |
305 | 302 | private List<Integer> completeRowObservations(FringeRow<S, I, O> f, List<Integer> cellIds) { |
306 | | - // TODO simplify collector calls when switching to newer java |
307 | | - final List<Word<I>> sufsPresent = cellIds.stream().map(c -> this.cells.get(c).getFirst()).collect(Collectors.toList()); |
308 | | - final List<Word<I>> sufsMissing = sufs.stream().filter(s -> !sufsPresent.contains(s)).collect(Collectors.toList()); |
| 303 | + final List<Word<I>> sufsPresent = cellIds.stream().map(c -> this.cells.get(c).getFirst()).toList(); |
| 304 | + final List<Word<I>> sufsMissing = sufs.stream().filter(s -> !sufsPresent.contains(s)).toList(); |
309 | 305 | final List<Integer> cellIdsFull = new ArrayList<>(cellIds); // important: copy elements! |
310 | 306 | sufsMissing.forEach(s -> cellIdsFull.add(getUniqueCellIdx(s, query(f, s)))); |
311 | 307 | return cellIdsFull; |
|
0 commit comments