/** * Creates a mutable {@link List} instance containing the given initial elements. * * @param elements * the initial elements that the list should contain, in order. May not be <code>null</code> but may * contain <code>null</code> values. * @return a new {@link List} containing those elements */ public static <T> List<T> list(T... elements){ return newArrayList(elements); }
public MatchParameterFilter(final Pair<String, ?>... parameters) { HashMap<String, Object> _newHashMap = CollectionLiterals.<String, Object>newHashMap(parameters); this.filterMap = _newHashMap; }
public Set<ComponentType> getTypes(final Component component) { final HashSet<ComponentType> result = CollectionLiterals.<ComponentType>newHashSet(); this.collectTypes(component, result); return result; }
/** * Creates a mutable {@link LinkedHashMap} instance containing the given initial entries. Repeated occurrences of a * keys will cause an {@link IllegalArgumentException}. * * @param initial * the entries that should be contained in the map. May not be <code>null</code> but may contain * <code>null</code> keys or values. * @return a new {@link LinkedHashMap} containing those elements * @throws IllegalArgumentException * if duplicate keys are contained the {@code initial} entries. */ @SafeVarargs @Pure public static <K, V> LinkedHashMap<K, V> newLinkedHashMap(Pair<? extends K, ? extends V>... initial) { if (initial.length > 0) { LinkedHashMap<K, V> result = new LinkedHashMap<K, V>(capacity(initial.length)); putAll(result, initial); return result; } return newLinkedHashMap(); }
/** * Creates a mutable {@link HashMap} instance containing the given initial entries. Repeated occurrences of a keys * will cause an {@link IllegalArgumentException}. * * @param initial * the entries that should be contained in the map. May not be <code>null</code> but may contain * <code>null</code> keys or values. * @return a new {@link HashMap} containing those elements * @throws IllegalArgumentException * if duplicate keys are contained the {@code initial} entries. */ @SafeVarargs @Pure public static <K, V> HashMap<K, V> newHashMap(Pair<? extends K, ? extends V>... initial) { if (initial.length > 0) { HashMap<K, V> result = new HashMap<K, V>(capacity(initial.length)); putAll(result, initial); return result; } return newHashMap(); }
public Set<ISyntacticSequencerPDAProvider.ISynTransition> getAllAmbiguousTransitions() { final Set<ISyntacticSequencerPDAProvider.ISynTransition> result = CollectionLiterals.<ISyntacticSequencerPDAProvider.ISynTransition>newLinkedHashSet(); List<ISyntacticSequencerPDAProvider.ISynAbsorberState> _allPDAs = this.getAllPDAs(); for (final ISyntacticSequencerPDAProvider.ISynAbsorberState start : _allPDAs) { this.collectAllAmbiguousTransitions(start, result, CollectionLiterals.<Object>newHashSet()); } return result; }
@Override public Collection<IHierarchyNode> buildRoots(final URI rootURI, final IProgressMonitor monitor) { final IEObjectDescription rootDeclaration = this.findDeclaration(rootURI); if ((rootDeclaration == null)) { return CollectionLiterals.<IHierarchyNode>emptyList(); } IHierarchyNode _createRoot = this.createRoot(rootDeclaration); return Collections.<IHierarchyNode>unmodifiableList(CollectionLiterals.<IHierarchyNode>newArrayList(_createRoot)); }
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); } }
public Map<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>> getGrammarConstraints(final Grammar grammar, final EClass clazz) { final Map<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>> result = CollectionLiterals.<IGrammarConstraintProvider.IConstraint, List<ISerializationContext>>newLinkedHashMap(); final SerializationContextMap<IGrammarConstraintProvider.IConstraint> constraints = this.gcp.getConstraints(grammar); List<SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint>> _values = constraints.values(); for (final SerializationContextMap.Entry<IGrammarConstraintProvider.IConstraint> e : _values) { { final IGrammarConstraintProvider.IConstraint constraint = e.getValue(); EClass _type = constraint.getType(); boolean _tripleEquals = (_type == clazz); if (_tripleEquals) { List<ISerializationContext> contexts = result.get(constraint); if ((contexts == null)) { contexts = CollectionLiterals.<ISerializationContext>newArrayList(); result.put(constraint, contexts); } contexts.addAll(e.getContexts(clazz)); } } } return result; }
protected Object getAttribute(final URI uri, final String attributeName) { Object _xblockexpression = null; { if ((uri == null)) { return null; } final HashMap<String, Set<String>> options = CollectionLiterals.<String, Set<String>>newHashMap(); options.put(URIConverter.OPTION_REQUESTED_ATTRIBUTES, Collections.<String>unmodifiableSet(CollectionLiterals.<String>newHashSet(attributeName))); _xblockexpression = this.getURIConverter().getAttributes(uri, options).get(attributeName); } return _xblockexpression; }
@Override public List<MessageIssue> validate(final Message message) { final ArrayList<MessageIssue> result = CollectionLiterals.<MessageIssue>newArrayList(); try { LinkedList<Object> _newLinkedList = CollectionLiterals.<Object>newLinkedList(); this.validate(message, result, _newLinkedList); } catch (final Throwable _t) { if (_t instanceof Exception) { final Exception e = (Exception)_t; StringConcatenation _builder = new StringConcatenation(); _builder.append("Error during message validation: "); String _message = e.getMessage(); _builder.append(_message, ""); MessageIssue _messageIssue = new MessageIssue(_builder.toString()); result.add(_messageIssue); } else if (_t instanceof NoClassDefFoundError) { final NoClassDefFoundError e_1 = (NoClassDefFoundError)_t; String _message_1 = e_1.getMessage(); boolean _endsWith = _message_1.endsWith("Nullable"); boolean _not = (!_endsWith); if (_not) { throw e_1; } } else { throw Exceptions.sneakyThrow(_t); } } return result; }
private static <K extends Object, V extends Object> Map<K, V> toMap(final Iterable<Pair<K, V>> items) { LinkedHashMap<K, V> _xblockexpression = null; { final LinkedHashMap<K, V> result = CollectionLiterals.<K, V>newLinkedHashMap(); for (final Pair<K, V> i : items) { result.put(i.getKey(), i.getValue()); } _xblockexpression = result; } return _xblockexpression; }
@Override public List<Either<SymbolInformation, DocumentSymbol>> getSymbols(final Document document, final XtextResource resource, final DocumentSymbolParams params, final CancelIndicator cancelIndicator) { return CollectionLiterals.<Either<SymbolInformation, DocumentSymbol>>emptyList(); } }
@Override public Map<String, ?> contentDescription(final URI uri, final Map<?, ?> options) throws IOException { return CollectionLiterals.<String, Object>emptyMap(); }
/** * Creates a mutable {@link LinkedList} instance containing the given initial elements. * * @param initial * the initial elements that the list should contain, in order. May not be <code>null</code> but may * contain <code>null</code> values. * @return a new {@link LinkedList} containing those elements */ @SafeVarargs @Pure public static <T> LinkedList<T> newLinkedList(T... initial) { if (initial.length > 0) return Lists.newLinkedList(Arrays.asList(initial)); return newLinkedList(); }
@Override public Collection<IHierarchyNode> buildChildren(final IHierarchyNode parent, final IProgressMonitor monitor) { boolean _mayHaveChildren = parent.mayHaveChildren(); boolean _not = (!_mayHaveChildren); if (_not) { return CollectionLiterals.<IHierarchyNode>emptyList(); } final LinkedHashMap<URI, IHierarchyNode> children = CollectionLiterals.<URI, IHierarchyNode>newLinkedHashMap(); final Procedure2<IEObjectDescription, IReferenceDescription> _function = (IEObjectDescription declaration, IReferenceDescription reference) -> { final IHierarchyNode childNode = this.createChild(children, declaration, parent); if ((childNode != null)) { final IHierarchyNodeReference nodeReference = this.createNodeReference(reference); if ((nodeReference != null)) { Collection<IHierarchyNodeReference> _references = childNode.getReferences(); _references.add(nodeReference); } } }; this.findDeclarations(parent, monitor, _function); return children.values(); }
public IncrementalBuilder.Result doInitialBuild(final CancelIndicator cancelIndicator) { final ArrayList<URI> uris = CollectionLiterals.<URI>newArrayList(); final Consumer<ISourceFolder> _function = (ISourceFolder it) -> { final IAcceptor<URI> _function_1 = (URI it_1) -> { uris.add(it_1); }; this.fileSystemScanner.scan(it.getPath(), _function_1); }; this.projectConfig.getSourceFolders().forEach(_function); return this.doBuild(uris, CollectionLiterals.<URI>emptyList(), CollectionLiterals.<IResourceDescription.Delta>emptyList(), cancelIndicator); }
final Function2<Map<SwitchCase, ArrayList<Statement>>, Statement, Map<SwitchCase, ArrayList<Statement>>> _function = (Map<SwitchCase, ArrayList<Statement>> map, Statement currStatement) -> { if ((currStatement instanceof SwitchCase)) { map.put(((SwitchCase)currStatement), CollectionLiterals.<Statement>newArrayList()); } else { map.get(IterableExtensions.<SwitchCase>last(map.keySet())).add(currStatement); }; final Map<SwitchCase, ArrayList<Statement>> foldedCases = IterableExtensions.<Statement, Map<SwitchCase, ArrayList<Statement>>>fold(node.statements(), CollectionLiterals.<SwitchCase, ArrayList<Statement>>newLinkedHashMap(), _function); final BiConsumer<SwitchCase, ArrayList<Statement>> _function_1 = (SwitchCase switchCase, ArrayList<Statement> statements) -> { switchCase.accept(this);
protected void withOutputConfig(final BuildRequest it, final Procedure1<? super OutputConfiguration> init) { Set<OutputConfiguration> _outputConfigurations = this.configurationProvider.getOutputConfigurations(); final OutputConfiguration config = IterableExtensions.<OutputConfiguration>head(_outputConfigurations); init.apply(config); Pair<String, Set<OutputConfiguration>> _mappedTo = Pair.<String, Set<OutputConfiguration>>of(this.languageName, Collections.<OutputConfiguration>unmodifiableSet(CollectionLiterals.<OutputConfiguration>newHashSet(config))); final OutputConfigurationAdapter adapter = new OutputConfigurationAdapter(Collections.<String, Set<OutputConfiguration>>unmodifiableMap(CollectionLiterals.<String, Set<OutputConfiguration>>newHashMap(_mappedTo))); XtextResourceSet _resourceSet = it.getResourceSet(); EList<Adapter> _eAdapters = _resourceSet.eAdapters(); _eAdapters.add(adapter); }
final LinkedHashMap<String, JsonRpcMethod> supportedMethods = CollectionLiterals.<String, JsonRpcMethod>newLinkedHashMap(); supportedMethods.putAll(ServiceEndpoints.getSupportedMethods(this.getClass())); final LinkedHashMap<String, JsonRpcMethod> extensions = CollectionLiterals.<String, JsonRpcMethod>newLinkedHashMap(); Iterable<IResourceServiceProvider> _filter = Iterables.<IResourceServiceProvider>filter(IterableExtensions.<Object>toSet(this.languagesRegistry.getExtensionToFactoryMap().values()), IResourceServiceProvider.class); for (final IResourceServiceProvider resourceServiceProvider : _filter) {