ElementPatternCondition<T> () { if (myConditions == null) { return new ElementPatternCondition<>(myInitialCondition); } if (myConditions instanceof PatternCondition) { PatternCondition<? super T> singleCondition = (PatternCondition)myConditions; return new ElementPatternCondition<>(myInitialCondition, Collections.singletonList(singleCondition)); } return new ElementPatternCondition<>(myInitialCondition, (List)myConditions); }