### Question:
Optimizer { static Matcher removeTrueInSequence(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); List<Matcher> ms = new ArrayList<>(); for (Matcher m : matchers) { if (!(m instanceof TrueMatcher)) { ms.add(m); } } return SeqMatcher.create(ms); } return matcher; } private  Optimizer();   }### Answer:
@Test public void removeTrueInSequence() { Matcher input = SeqMatcher.create( AnyMatcher.INSTANCE, TrueMatcher.INSTANCE, AnyMatcher.INSTANCE ); Matcher expected = SeqMatcher.create( AnyMatcher.INSTANCE, AnyMatcher.INSTANCE ); Assertions.assertEquals(expected, Optimizer.removeTrueInSequence(input)); }