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; }
/** * 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(); }
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) {
private Map<TemplateVariable, Optional<JvmTypeReference>> getVariablesWithTypes(final TestStep step, final Iterable<TemplateVariable> variables) { final LinkedHashMap<TemplateVariable, Optional<JvmTypeReference>> result = CollectionLiterals.<TemplateVariable, Optional<JvmTypeReference>>newLinkedHashMap(); final TemplateContainer templateContainer = this._tclModelUtil.getTemplateContainer(step); if ((templateContainer != null)) { final Map<TemplateVariable, Optional<JvmTypeReference>> templateVariableToType = this.getVariablesWithTypes(templateContainer); final LinkedHashMap<StepContent, TemplateVariable> stepContentToTemplateVariable = this._tclModelUtil.getStepContentToTemplateVariablesMapping(step, templateContainer.getTemplate()); for (final TemplateVariable variable : variables) { { final Function1<VariableReference, Boolean> _function = (VariableReference it) -> { Variable _variable = it.getVariable(); return Boolean.valueOf(Objects.equal(_variable, variable)); }; final VariableReference variableReference = IterableExtensions.<VariableReference>findFirst(Iterables.<VariableReference>filter(stepContentToTemplateVariable.keySet(), VariableReference.class), _function); if ((variableReference != null)) { final Optional<JvmTypeReference> optionalType = templateVariableToType.get(stepContentToTemplateVariable.get(variableReference)); Optional<JvmTypeReference> _elvis = null; if (optionalType != null) { _elvis = optionalType; } else { Optional<JvmTypeReference> _empty = Optional.<JvmTypeReference>empty(); _elvis = _empty; } result.put(variable, _elvis); } } } } return result; }
protected Map<TemplateVariable, Optional<JvmTypeReference>> _getVariablesWithTypes(final Macro macro) { final LinkedHashMap<TemplateVariable, Optional<JvmTypeReference>> result = CollectionLiterals.<TemplateVariable, Optional<JvmTypeReference>>newLinkedHashMap(); final Iterable<TemplateVariable> variables = Iterables.<TemplateVariable>filter(macro.getTemplate().getContents(), TemplateVariable.class); final Function1<TemplateVariable, Optional<JvmTypeReference>> _function = (TemplateVariable it) -> { return Optional.<JvmTypeReference>empty(); }; result.putAll(IterableExtensions.<TemplateVariable, Optional<JvmTypeReference>>toInvertedMap(variables, _function)); EList<TestStepContext> _contexts = macro.getContexts(); for (final TestStepContext context : _contexts) { { final Function1<TestStep, Boolean> _function_1 = (TestStep it) -> { boolean _isEmpty = IterableExtensions.isEmpty(Iterables.<VariableReference>filter(it.getContents(), VariableReference.class)); return Boolean.valueOf((!_isEmpty)); }; final Iterable<TestStep> stepsWithVariableReferences = IterableExtensions.<TestStep>filter(Iterables.<TestStep>filter(context.getSteps(), TestStep.class), _function_1); for (final TestStep step : stepsWithVariableReferences) { result.putAll(this.getVariablesWithTypes(step, variables)); } } } return result; }
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; }
final LinkedHashMap<String, String> properties = CollectionLiterals.<String, String>newLinkedHashMap(); Set<Map.Entry<String, Either3<String, Number, Boolean>>> _entrySet = this.entrySet(); for (final Map.Entry<String, Either3<String, Number, Boolean>> entry : _entrySet) {
final LinkedHashMap<String, String> properties = CollectionLiterals.<String, String>newLinkedHashMap(); Set<Map.Entry<String, Either3<String, Number, Boolean>>> _entrySet = this.entrySet(); for (final Map.Entry<String, Either3<String, Number, Boolean>> entry : _entrySet) {
@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(); }
final LinkedHashMap<String, String> logicalMap = CollectionLiterals.<String, String>newLinkedHashMap(); Set<Map.Entry<EObject, JvmIdentifiableElement>> _entrySet = adapter.logicalContainerMap.entrySet(); for (final Map.Entry<EObject, JvmIdentifiableElement> entry : _entrySet) { final LinkedHashMap<String, LinkedHashSet<String>> sourceToTarget = CollectionLiterals.<String, LinkedHashSet<String>>newLinkedHashMap(); Set<Map.Entry<EObject, Set<EObject>>> _entrySet_1 = adapter.sourceToTargetMap.entrySet(); for (final Map.Entry<EObject, Set<EObject>> entry_1 : _entrySet_1) { final LinkedHashMap<String, LinkedHashSet<String>> targetToSource = CollectionLiterals.<String, LinkedHashSet<String>>newLinkedHashMap(); Set<Map.Entry<EObject, Set<EObject>>> _entrySet_2 = adapter.targetToSourceMap.entrySet(); for (final Map.Entry<EObject, Set<EObject>> entry_2 : _entrySet_2) {
public void generateThrowsClause(final JvmExecutable it, final ITreeAppendable appendable, final GeneratorConfig config) { final LinkedHashMap<JvmType, JvmTypeReference> toBeGenerated = CollectionLiterals.<JvmType, JvmTypeReference>newLinkedHashMap(); final Consumer<JvmTypeReference> _function = (JvmTypeReference it_1) -> { boolean _containsKey = toBeGenerated.containsKey(it_1.getType()); boolean _not = (!_containsKey); if (_not) { toBeGenerated.put(it_1.getType(), it_1); } }; it.getExceptions().forEach(_function); final Procedure1<LoopParams> _function_1 = (LoopParams it_1) -> { it_1.setPrefix(" throws "); it_1.setSeparator(", "); }; final Procedure2<JvmTypeReference, ITreeAppendable> _function_2 = (JvmTypeReference it_1, ITreeAppendable app) -> { app.trace(it_1).append(it_1.getType()); }; this._errorSafeExtensions.<JvmTypeReference>forEachSafely(appendable, toBeGenerated.values(), _function_1, _function_2); }
LinkedHashMap<String, String> _newLinkedHashMap = CollectionLiterals.<String, String>newLinkedHashMap(); final MapBasedPreferenceValues preferences = new MapBasedPreferenceValues(formatterPreferences, _newLinkedHashMap); preferences.<String>put(FormatterPreferenceKeys.lineSeparator, lineSeparator);
throw new IllegalArgumentException(message); final LinkedHashMap<StepContent, TemplateVariable> map = CollectionLiterals.<StepContent, TemplateVariable>newLinkedHashMap(); for (int i = 0; (i < IterableExtensions.size(templateVariables)); i++) { map.put(((StepContent[])Conversions.unwrapArray(stepContentElements, StepContent.class))[i], ((TemplateVariable[])Conversions.unwrapArray(templateVariables, TemplateVariable.class))[i]);
}; 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);
public CharSequence generateRequestWithTrailingComma(final Path path, final Operation operation) { CharSequence _xblockexpression = null; final LinkedHashMap<String, IModelPart<OpenApi3, ?>> values = CollectionLiterals.<String, IModelPart<OpenApi3, ?>>newLinkedHashMap(); final Consumer<String> _function = (String k) -> { values.put(k, operation.getRequestBody().getContentMediaTypes().get(k).getSchema());
Pair<String, Double> _mappedTo = Pair.<String, Double>of("foo", Double.valueOf(12.3)); Pair<String, String> _mappedTo_1 = Pair.<String, String>of("bar", "qwertz"); it.setParams(CollectionLiterals.<String, Object>newLinkedHashMap(_mappedTo, _mappedTo_1)); }; NotificationMessage _doubleArrow = ObjectExtensions.<NotificationMessage>operator_doubleArrow(_notificationMessage, _function);