### Question:
Optimizer { static Matcher dedupOr(Matcher matcher) { if (matcher instanceof OrMatcher) { List<Matcher> ms = new ArrayList<>( new LinkedHashSet<>(matcher.<OrMatcher>as().matchers())); return OrMatcher.create(ms); } return matcher; } private  Optimizer();   }### Answer:
@Test public void dedupOr() { Matcher input = OrMatcher.create( new CharSeqMatcher("a"), new CharSeqMatcher("b"), new CharSeqMatcher("a") ); Matcher expected = OrMatcher.create( new CharSeqMatcher("a"), new CharSeqMatcher("b") ); Assertions.assertEquals(expected, Optimizer.dedupOr(input)); }