### Question:
Optimizer { static Matcher combineAdjacentStart(Matcher matcher) { if (matcher instanceof SeqMatcher) { List<Matcher> matchers = matcher.<SeqMatcher>as().matchers(); if (!matchers.isEmpty() && matchers.get(0) instanceof StartMatcher) { List<Matcher> ms = new ArrayList<>(); ms.add(StartMatcher.INSTANCE); int pos = 0; for (Matcher m : matchers) { if (m instanceof StartMatcher) { ++pos; } else { break; } } ms.addAll(matchers.subList(pos, matchers.size())); return SeqMatcher.create(ms); } } return matcher; } private  Optimizer();   }### Answer:
@Test public void combineAdjacentStart() { Matcher input = SeqMatcher.create( StartMatcher.INSTANCE, StartMatcher.INSTANCE, StartMatcher.INSTANCE, StartMatcher.INSTANCE, AnyMatcher.INSTANCE ); Matcher expected = SeqMatcher.create(StartMatcher.INSTANCE, AnyMatcher.INSTANCE); Assertions.assertEquals(expected, Optimizer.combineAdjacentStart(input)); }