### Question:
Optimizer { static Matcher sequenceWithStuffAfterEndIsFalse(Matcher matcher) { if (matcher instanceof SeqMatcher) { boolean end = false; for (Matcher m : matcher.<SeqMatcher>as().matchers()) { if (m instanceof EndMatcher) { end = true; } else if (end && !m.alwaysMatches()) { return FalseMatcher.INSTANCE; } } } return matcher; } private  Optimizer();   }### Answer:
@Test public void sequenceWithStuffAfterEndIsFalse() { Matcher input = SeqMatcher.create( AnyMatcher.INSTANCE, EndMatcher.INSTANCE, AnyMatcher.INSTANCE ); Matcher expected = FalseMatcher.INSTANCE; Assertions.assertEquals(expected, Optimizer.sequenceWithStuffAfterEndIsFalse(input)); }