/** * Creates a sorted list that contains the items of the given iterable. The resulting list is sorted according to * the order induced by the specified comparator. * * @param iterable * the items to be sorted. May not be <code>null</code>. * @param comparator * the comparator to be used. May be <code>null</code> to indicate that the natural ordering of the * elements should be used. * @return a sorted list as a shallow copy of the given iterable. * @see Collections#sort(List, Comparator) * @see #sort(Iterable) * @see #sortBy(Iterable, org.eclipse.xtext.xbase.lib.Functions.Function1) * @see ListExtensions#sortInplace(List, Comparator) * @since 2.7 */ public static <T> List<T> sortWith(Iterable<T> iterable, Comparator<? super T> comparator) { return ListExtensions.sortInplace(Lists.newArrayList(iterable), comparator); }
/** * Creates a sorted list that contains the items of the given iterable. The resulting list is sorted according to * the order induced by the specified comparator. * * @param iterable * the items to be sorted. May not be <code>null</code>. * @param comparator * the comparator to be used. May be <code>null</code> to indicate that the natural ordering of the * elements should be used. * @return a sorted list as a shallow copy of the given iterable. * @see Collections#sort(List, Comparator) * @see #sort(Iterable) * @see #sortBy(Iterable, org.eclipse.xtext.xbase.lib.Functions.Function1) * @see ListExtensions#sortInplace(List, Comparator) * @since 2.7 */ public static <T> List<T> sortWith(Iterable<T> iterable, Comparator<? super T> comparator) { return ListExtensions.sortInplace(Lists.newArrayList(iterable), comparator); }
/** * Creates a sorted list that contains the items of the given iterable. The resulting list is in ascending order, * according to the natural ordering of the elements in the iterable. * * @param iterable * the items to be sorted. May not be <code>null</code>. * @return a sorted list as a shallow copy of the given iterable. * @see Collections#sort(List) * @see #sort(Iterable, Comparator) * @see #sortBy(Iterable, org.eclipse.xtext.xbase.lib.Functions.Function1) * @see ListExtensions#sortInplace(List) */ public static <T extends Comparable<? super T>> List<T> sort(Iterable<T> iterable) { List<T> asList = Lists.newArrayList(iterable); if (iterable instanceof SortedSet<?>) { if (((SortedSet<T>) iterable).comparator() == null) { return asList; } } return ListExtensions.sortInplace(asList); }
/** * Creates a sorted list that contains the items of the given iterable. The resulting list is in ascending order, * according to the natural ordering of the elements in the iterable. * * @param iterable * the items to be sorted. May not be <code>null</code>. * @return a sorted list as a shallow copy of the given iterable. * @see Collections#sort(List) * @see #sort(Iterable, Comparator) * @see #sortBy(Iterable, org.eclipse.xtext.xbase.lib.Functions.Function1) * @see ListExtensions#sortInplace(List) */ public static <T extends Comparable<? super T>> List<T> sort(Iterable<T> iterable) { List<T> asList = Lists.newArrayList(iterable); if (iterable instanceof SortedSet<?>) { if (((SortedSet<T>) iterable).comparator() == null) { return asList; } } return ListExtensions.sortInplace(asList); }
public List<EqualAmbiguousTransitions> getAllAmbiguousTransitionsBySyntax() { if ((this.ambiguousTransitions != null)) { return this.ambiguousTransitions; } final Map<GrammarAlias.AbstractElementAlias, EqualAmbiguousTransitions> result = CollectionLiterals.<GrammarAlias.AbstractElementAlias, EqualAmbiguousTransitions>newHashMap(); Set<ISyntacticSequencerPDAProvider.ISynTransition> _allAmbiguousTransitions = this.getAllAmbiguousTransitions(); for (final ISyntacticSequencerPDAProvider.ISynTransition transition : _allAmbiguousTransitions) { List<GrammarAlias.AbstractElementAlias> _ambiguousSyntaxes = transition.getAmbiguousSyntaxes(); for (final GrammarAlias.AbstractElementAlias syntax : _ambiguousSyntaxes) { { EqualAmbiguousTransitions list = result.get(syntax); if ((list == null)) { String _elementAliasToIdentifier = this.elementAliasToIdentifier(syntax); EqualAmbiguousTransitions _equalAmbiguousTransitions = new EqualAmbiguousTransitions(_elementAliasToIdentifier, syntax); list = _equalAmbiguousTransitions; result.put(syntax, list); } list.getTransitions().add(transition); } } } this.ambiguousTransitions = CollectionLiterals.<EqualAmbiguousTransitions>newArrayList(((EqualAmbiguousTransitions[])Conversions.unwrapArray(result.values(), EqualAmbiguousTransitions.class))); ListExtensions.<EqualAmbiguousTransitions>sortInplace(this.ambiguousTransitions); return this.ambiguousTransitions; }
protected String elementAliasToIdentifier(final GrammarAlias.AbstractElementAlias alias) { final Set<String> rulesSet = CollectionLiterals.<String>newHashSet(); final String body = this.elementAliasToIdentifier(alias, rulesSet, false); final List<String> rulesList = CollectionLiterals.<String>newArrayList(((String[])Conversions.unwrapArray(rulesSet, String.class))); ListExtensions.<String>sortInplace(rulesList); final String rule = IterableExtensions.join(rulesList, "_"); return ((rule + "_") + body); } }
children_1.add(this.elementAliasToIdentifier(child_1, rules, true)); ListExtensions.<String>sortInplace(children_1); final String body_1 = IterableExtensions.join(children_1, "_or_"); if ((isNested || (card != null))) {