String output(final List<String> variableNames) { Joiner _on = Joiner.on(", "); final Function1<String, String> _function = new Function1<String, String>() { @Override public String apply(final String it) { return BodyCodeGenerator.escape(it); } }; List<String> _map = ListExtensions.<String, String>map(variableNames, _function); return _on.join(_map); }
/** * Creates a sorted list that contains the items of the given iterable. The resulting list is sorted according to * the order induced by applying a key function to each element which yields a comparable criteria. * * @param iterable * the elements to be sorted. May not be <code>null</code>. * @param key * the key function to-be-used. May not be <code>null</code>. * @return a sorted list as a shallow copy of the given iterable. * @see #sort(Iterable) * @see #sort(Iterable, Comparator) * @see ListExtensions#sortInplaceBy(List, org.eclipse.xtext.xbase.lib.Functions.Function1) */ public static <T, C extends Comparable<? super C>> List<T> sortBy(Iterable<T> iterable, final Functions.Function1<? super T, C> key) { return ListExtensions.sortInplaceBy(Lists.newArrayList(iterable), key); }
/** * 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); }
private String removeIndentation(final String text) { String[] lines = text.split("(?m)^"); final String[] _converted_lines = (String[])lines; final Function1<String, Boolean> _function = (String it) -> { return Boolean.valueOf(it.trim().isEmpty()); }; lines = ((String[])Conversions.unwrapArray(IterableExtensions.<String>dropWhile(((Iterable<? extends String>)Conversions.doWrapArray(_converted_lines)), _function), String.class)); final String[] _converted_lines_1 = (String[])lines; final Function1<String, Boolean> _function_1 = (String it) -> { return Boolean.valueOf(it.trim().isEmpty()); }; lines = ((String[])Conversions.unwrapArray(ListExtensions.<String>reverse(IterableExtensions.<String>toList(IterableExtensions.<String>dropWhile(ListExtensions.<String>reverse(((List<String>)Conversions.doWrapArray(_converted_lines_1))), _function_1))), String.class)); final String[] _converted_lines_2 = (String[])lines; final String indent = this.findIndent(IterableExtensions.<String>head(((Iterable<String>)Conversions.doWrapArray(_converted_lines_2)))); final String[] _converted_lines_3 = (String[])lines; final Function1<String, Boolean> _function_2 = (String it) -> { return Boolean.valueOf(it.startsWith(indent)); }; boolean _forall = IterableExtensions.<String>forall(((Iterable<String>)Conversions.doWrapArray(_converted_lines_3)), _function_2); if (_forall) { final String[] _converted_lines_4 = (String[])lines; final Function1<String, String> _function_3 = (String it) -> { return it.substring(indent.length()); }; return IterableExtensions.join(ListExtensions.<String, String>map(((List<String>)Conversions.doWrapArray(_converted_lines_4)), _function_3), "\n"); } else { return text; } }
protected List<ILeafNode> findPreviousHiddenLeafs(final INode node) { List<ILeafNode> _xblockexpression = null; { INode current = node; while ((current instanceof ICompositeNode)) { current = ((ICompositeNode)current).getLastChild(); } final ArrayList<ILeafNode> result = CollectionLiterals.<ILeafNode>newArrayList(); if ((current != null)) { final NodeIterator ni = new NodeIterator(current); while (ni.hasPrevious()) { { final INode previous = ni.previous(); if (((!Objects.equal(previous, current)) && (previous instanceof ILeafNode))) { boolean _isHidden = ((ILeafNode) previous).isHidden(); if (_isHidden) { result.add(((ILeafNode) previous)); } else { return ListExtensions.<ILeafNode>reverse(result); } } } } } _xblockexpression = ListExtensions.<ILeafNode>reverse(result); } return _xblockexpression; } }
return it_1.message; }; it.setData(IterableExtensions.join(ListExtensions.<ServerRefactoringIssueAcceptor.Issue, String>map(ListExtensions.<ServerRefactoringIssueAcceptor.Issue>reverse(IterableExtensions.<ServerRefactoringIssueAcceptor.Issue, RefactoringIssueAcceptor.Severity>sortBy(this.issues, _function_1)), _function_2), "\n")); int _switchResult_1 = (int) 0; if (maxSeverity != null) {
List<XBinaryOperation> _reverse = ListExtensions.<XBinaryOperation>reverse(calls); for (final XBinaryOperation call : _reverse) {
String output(final List<String> variableNames) { final Function1<String, String> _function = (String it) -> { return BodyCodeGenerator.escape(it); }; return Joiner.on(", ").join(ListExtensions.<String, String>map(variableNames, _function)); }
/** * Creates a sorted list that contains the items of the given iterable. The resulting list is sorted according to * the order induced by applying a key function to each element which yields a comparable criteria. * * @param iterable * the elements to be sorted. May not be <code>null</code>. * @param key * the key function to-be-used. May not be <code>null</code>. * @return a sorted list as a shallow copy of the given iterable. * @see #sort(Iterable) * @see #sort(Iterable, Comparator) * @see ListExtensions#sortInplaceBy(List, org.eclipse.xtext.xbase.lib.Functions.Function1) */ public static <T, C extends Comparable<? super C>> List<T> sortBy(Iterable<T> iterable, final Functions.Function1<? super T, C> key) { return ListExtensions.sortInplaceBy(Lists.newArrayList(iterable), key); }
/** * 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); }
List<XMemberFeatureCall> _reverse = ListExtensions.<XMemberFeatureCall>reverse(calls); for (final XMemberFeatureCall call : _reverse) {
public FilteringClassLoader(final ClassLoader parent, final List<String> includes) { super(parent); final Function1<String, String> _function = (String it) -> { return (it + Character.valueOf(FilteringClassLoader.DOT)); }; this.includes = ImmutableList.<String>copyOf(ListExtensions.<String, String>map(includes, _function)); final Function1<String, String> _function_1 = (String it) -> { return it.replace(FilteringClassLoader.DOT, FilteringClassLoader.SLASH); }; final Function1<String, String> _function_2 = (String it) -> { return (it + Character.valueOf(FilteringClassLoader.SLASH)); }; this.resourceIncludes = ImmutableList.<String>copyOf(ListExtensions.<String, String>map(ListExtensions.<String, String>map(includes, _function_1), _function_2)); }
public void writeTokenFile(PrintWriter out) throws IOException { List<Map.Entry<Integer, String>> entries = Lists.newArrayList(getTokenDefMap().entrySet()); ListExtensions.sortInplaceBy(entries, new Functions.Function1<Map.Entry<Integer, String>, String>() { @Override public String apply(Map.Entry<Integer, String> p) { return p.getValue(); } }); for(Map.Entry<Integer, String> entry: entries) { out.print(entry.getValue()); out.print('='); out.println(entry.getKey()); } out.close(); }
/** * 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); }
private boolean containsParam(final EList<JvmFormalParameter> params, final String param) { final Function1<JvmFormalParameter, String> _function = (JvmFormalParameter it) -> { return it.getName(); }; return ListExtensions.<JvmFormalParameter, String>map(params, _function).contains(param); }
List<GenPackage> packages = Lists.newArrayList(model.getGenPackages()); assertEquals(packageNames.length, packages.size()); ListExtensions.sortInplaceBy(packages, new Functions.Function1<GenPackage, String>() { @Override public String apply(GenPackage p) {
/** * 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); }
private Iterable<IEObjectDescription> getVisibleEObjectDescriptions(final EObject o, final EClass type) { final Function1<IContainer, Iterable<IEObjectDescription>> _function = new Function1<IContainer, Iterable<IEObjectDescription>>() { @Override public Iterable<IEObjectDescription> apply(final IContainer container) { return container.getExportedObjectsByType(type); } }; return Iterables.<IEObjectDescription>concat(ListExtensions.<IContainer, Iterable<IEObjectDescription>>map(this.getVisibleContainers(o), _function)); }
return _builder.toString(); }; ListExtensions.<StringConcatenationClient, String>sortInplaceBy(children_1, _function); StringConcatenationClient _client_2 = new StringConcatenationClient() { @Override
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); } }