public static AbstractElement findFirstWithSameConflicts(final AbstractElement element, final Grammar grammar) {
		final List<String> conflicting = getConflictingKeywords(element, grammar);
		AbstractElement result = element;
		Iterator<AbstractElement> iterator = Iterators.filter(
				Iterators.filter(EcoreUtil.getAllContents(grammar, true), AbstractElement.class),
				new Predicate<AbstractElement>() {
					@Override
					public boolean apply(AbstractElement param) {
						final List<String> otherConflicting = getConflictingKeywords(param, grammar);
						return otherConflicting != null && otherConflicting.equals(conflicting);
					}
				});
		if (iterator.hasNext())
			result = iterator.next();

		return result;
	}
public static AbstractElement findFirstWithSameConflicts ( final AbstractElement element , final Grammar grammar ) { final List < String > conflicting = getConflictingKeywords ( element , grammar ) ; AbstractElement result = element ; Iterator < AbstractElement > iterator = Iterators . filter ( Iterators . filter ( EcoreUtil . getAllContents ( grammar , true ) , AbstractElement . class ) , new Predicate < AbstractElement > ( ) { @ Override public boolean apply ( AbstractElement param ) { final List < String > otherConflicting = getConflictingKeywords ( param , grammar ) ; return otherConflicting != null && otherConflicting . equals ( conflicting ) ; } } ) ; if ( iterator . hasNext ( ) ) result = iterator . next ( ) ; return result ; }
TODO think about super grammar