mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Use Stream.toList(); other minor fixes
GitOrigin-RevId: 80cd98f05d25a63413085a2c6ee2bd650d7f5716
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b1056c285e
commit
accd4283af
+2
-2
@@ -175,7 +175,7 @@ public final class FrequentlyUsedInheritorInspection extends AbstractBaseJavaLoc
|
||||
return null;
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
PsiResolveHelper resolveHelper = PsiResolveHelper.getInstance(project);
|
||||
return directInheritorStats
|
||||
@@ -184,7 +184,7 @@ public final class FrequentlyUsedInheritorInspection extends AbstractBaseJavaLoc
|
||||
.flatMap(c -> StreamEx.of(getClassesIfInterface(c, finalHierarchyCardinality, searchScope, place, project, compilerRefService)).prepend(c))
|
||||
.sorted()
|
||||
.limit(MAX_RESULT)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
}
|
||||
|
||||
private static List<ClassAndInheritorCount> getClassesIfInterface(@NotNull ClassAndInheritorCount classAndInheritorCount,
|
||||
|
||||
@@ -104,6 +104,8 @@ import io.netty.handler.codec.protobuf.ProtobufEncoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
|
||||
import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
|
||||
import io.netty.util.internal.ThreadLocalRandom;
|
||||
import one.util.streamex.EntryStream;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -511,14 +513,6 @@ public final class BuildManager implements Disposable {
|
||||
return;
|
||||
}
|
||||
synchronized (myProjectDataMap) {
|
||||
//if (IS_UNIT_TEST_MODE) {
|
||||
// if (notifyDeletion) {
|
||||
// LOG.info("Registering deleted paths: " + filtered);
|
||||
// }
|
||||
// else {
|
||||
// LOG.info("Registering changed paths: " + filtered);
|
||||
// }
|
||||
//}
|
||||
for (Map.Entry<String, ProjectData> entry : myProjectDataMap.entrySet()) {
|
||||
final ProjectData data = entry.getValue();
|
||||
if (notifyDeletion) {
|
||||
@@ -1139,15 +1133,17 @@ public final class BuildManager implements Disposable {
|
||||
if (configuration.getJavacCompiler().equals(configuration.getDefaultCompiler()) && JavacConfiguration.getOptions(project, JavacConfiguration.class).PREFER_TARGET_JDK_COMPILER) {
|
||||
// for javac, if compiler from associated SDK instead of cross-compilation is preferred, use a different policy:
|
||||
// select the most frequently used jdk from the sdks that are associated with the project, but not older than <oldestPossibleVersion>
|
||||
// this policy attempts to compile as much modules as possible without spawning a separate javac process
|
||||
// this policy attempts to compile as many modules as possible without spawning a separate javac process
|
||||
|
||||
final List<Pair<Sdk, JavaSdkVersion>> sortedSdks = candidates.entrySet().stream()
|
||||
.sorted(Map.Entry.<Sdk, Integer>comparingByValue().reversed())
|
||||
.map(entry -> Pair.create(entry.getKey(), JavaVersion.tryParse(entry.getKey().getVersionString())))
|
||||
.filter(p -> p.second != null && p.second.isAtLeast(oldestPossibleVersion))
|
||||
.map(p -> Pair.create(p.first, JavaSdkVersion.fromJavaVersion(p.second)))
|
||||
.filter(p -> p.second != null)
|
||||
.collect(Collectors.toList());
|
||||
final List<Pair<Sdk, JavaSdkVersion>> sortedSdks = EntryStream.of(candidates)
|
||||
.reverseSorted(Map.Entry.comparingByValue())
|
||||
.keys()
|
||||
.mapToEntry(sdk -> JavaVersion.tryParse(sdk.getVersionString()))
|
||||
.filterValues(version -> version != null && version.isAtLeast(oldestPossibleVersion))
|
||||
.mapValues(JavaSdkVersion::fromJavaVersion)
|
||||
.nonNullValues()
|
||||
.mapKeyValue(Pair::create)
|
||||
.toList();
|
||||
|
||||
if (!sortedSdks.isEmpty()) {
|
||||
// first try to find most used JDK of version 9 and newer => JRT FS support will be needed
|
||||
@@ -1157,11 +1153,11 @@ public final class BuildManager implements Disposable {
|
||||
}
|
||||
|
||||
// now select the latest version from the sdks that are used in the project, but not older than <oldestPossibleVersion>
|
||||
return candidates.keySet().stream()
|
||||
.map(sdk -> Pair.create(sdk, JavaVersion.tryParse(sdk.getVersionString())))
|
||||
.filter(p -> p.second != null && p.second.isAtLeast(oldestPossibleVersion))
|
||||
.max(Pair.comparingBySecond())
|
||||
.map(p -> Pair.create(p.first, JavaSdkVersion.fromJavaVersion(p.second)))
|
||||
return StreamEx.ofKeys(candidates)
|
||||
.mapToEntry(sdk -> JavaVersion.tryParse(sdk.getVersionString()))
|
||||
.filterValues(version -> version != null && version.isAtLeast(oldestPossibleVersion))
|
||||
.max(Map.Entry.comparingByValue())
|
||||
.map(p -> Pair.create(p.getKey(), JavaSdkVersion.fromJavaVersion(p.getValue())))
|
||||
.filter(p -> p.second != null)
|
||||
.orElseGet(() -> {
|
||||
Sdk internalJdk = JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk();
|
||||
|
||||
+1
-1
@@ -611,7 +611,7 @@ public final class HighlightClassUtil {
|
||||
return (parameters.length == 0 || parameters.length == 1 && parameters[0].isVarArgs()) &&
|
||||
resolveHelper.isAccessible(constructor, aClass, null);
|
||||
})
|
||||
.limit(2).collect(Collectors.toList());
|
||||
.limit(2).toList();
|
||||
|
||||
if (constructorCandidates.size() >= 2) {// two ambiguous var-args-only constructors
|
||||
String m1 = PsiFormatUtil.formatMethod(constructorCandidates.get(0), PsiSubstitutor.EMPTY,
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ public class IOStreamConstructorInspection extends AbstractBaseJavaLocalInspecti
|
||||
// maybe we can reuse already created file.toPath() / Path.of(...) variable
|
||||
List<PsiVariable> pathVars = Arrays.stream(occurrences).map(o -> findVariableAssignedTo(o))
|
||||
.filter(var -> var != null && HighlightControlFlowUtil.isEffectivelyFinal(var, toPathConversion, null))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (!pathVars.isEmpty()) {
|
||||
PsiCodeBlock body = containingMethod.getBody();
|
||||
if (body == null) return;
|
||||
|
||||
+4
-7
@@ -7,12 +7,11 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiTypesUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
final class ExtractGeneratedClassUtil {
|
||||
private static final String GENERATED_CLASS_PACKAGE = "idea.debugger.rt";
|
||||
@@ -118,8 +117,7 @@ final class ExtractGeneratedClassUtil {
|
||||
super.visitNewExpression(expression);
|
||||
PsiMethod constructor = expression.resolveConstructor();
|
||||
if (constructor != null && generatedClass.equals(constructor.getContainingClass())) {
|
||||
List<PsiMethod> methods =
|
||||
Arrays.stream(extractedClass.getConstructors()).filter(x -> isSameMethod(x, constructor)).collect(Collectors.toList());
|
||||
List<PsiMethod> methods = ContainerUtil.filter(extractedClass.getConstructors(), x -> isSameMethod(x, constructor));
|
||||
if (methods.size() == 1) {
|
||||
LOG.info("Replace constructor: " + constructor.getName());
|
||||
constructor.putUserData(LightMethodObjectExtractedData.REFERENCE_METHOD, methods.get(0));
|
||||
@@ -132,8 +130,7 @@ final class ExtractGeneratedClassUtil {
|
||||
super.visitMethodCallExpression(expression);
|
||||
PsiMethod method = expression.resolveMethod();
|
||||
if (method != null && generatedClass.equals(method.getContainingClass())) {
|
||||
List<PsiMethod> methods =
|
||||
Arrays.stream(extractedClass.getMethods()).filter(x -> isSameMethod(x, method)).collect(Collectors.toList());
|
||||
List<PsiMethod> methods = ContainerUtil.filter(extractedClass.getMethods(), x -> isSameMethod(x, method));
|
||||
if (methods.size() == 1) {
|
||||
LOG.info("Replace method: " + method.getName());
|
||||
method.putUserData(LightMethodObjectExtractedData.REFERENCE_METHOD, methods.get(0));
|
||||
@@ -141,7 +138,7 @@ final class ExtractGeneratedClassUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isSameMethod(@NotNull PsiMethod first, @NotNull PsiMethod second) {
|
||||
private static boolean isSameMethod(@NotNull PsiMethod first, @NotNull PsiMethod second) {
|
||||
if (first.getName().equals(second.getName())) {
|
||||
return first.getParameterList().getParametersCount() == second.getParameterList().getParametersCount();
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class IconLineMarkerProvider extends LineMarkerProviderDescriptor {
|
||||
.stream()
|
||||
.filter(constant -> constant instanceof UStringConstant)
|
||||
.map(UConstant::getSource)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (!constants.isEmpty()) {
|
||||
UIdentifier identifier = expression.getMethodIdentifier();
|
||||
if (identifier != null) {
|
||||
|
||||
+1
-2
@@ -121,8 +121,7 @@ public class AddAnnotationAttributeNameFix extends LocalQuickFixAndIntentionActi
|
||||
|
||||
final Collection<PsiMethod> availableMethods = Arrays.stream(annotationClass.getMethods())
|
||||
.filter(PsiAnnotationMethod.class::isInstance)
|
||||
.filter(psiMethod -> !usedNames.contains(psiMethod.getName()))
|
||||
.collect(Collectors.toList());
|
||||
.filter(psiMethod -> !usedNames.contains(psiMethod.getName())).toList();
|
||||
|
||||
if (!availableMethods.isEmpty()) {
|
||||
final PsiType valueType = CreateAnnotationMethodFromUsageFix.getAnnotationValueType(value);
|
||||
|
||||
@@ -243,8 +243,7 @@ public abstract class OrderEntryFix implements IntentionAction, LocalQuickFix {
|
||||
ProjectFileIndex index = ProjectRootManager.getInstance(currentModule.getProject()).getFileIndex();
|
||||
List<PsiElement> targets = Stream.of(reference.multiResolve(true))
|
||||
.map(ResolveResult::getElement)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
.filter(Objects::nonNull).toList();
|
||||
|
||||
PsiElement statement = reference.getElement().getParent();
|
||||
boolean exported = statement instanceof PsiRequiresStatement &&
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ public class AnnotateIntentionAction extends BaseIntentionAction implements LowP
|
||||
if (owner == null || owner.getModifierList() == null || !ExternalAnnotationsManagerImpl.areExternalAnnotationsApplicable(owner)) {
|
||||
return false;
|
||||
}
|
||||
List<AnnotationProvider> annotations = availableAnnotations(owner, project).limit(2).collect(Collectors.toList());
|
||||
List<AnnotationProvider> annotations = availableAnnotations(owner, project).limit(2).toList();
|
||||
if (annotations.isEmpty()) return false;
|
||||
if (mySingleAnnotationName != null && canAnnotateWith(file, owner, mySingleAnnotationName)) return true;
|
||||
if (annotations.size() == 1) {
|
||||
|
||||
+1
-1
@@ -527,7 +527,7 @@ public final class MagicConstantInspection extends AbstractBaseJavaLocalInspecti
|
||||
@Override
|
||||
public String getText() {
|
||||
List<String> names = myMemberValuePointers.stream().map(SmartPsiElementPointer::getElement).filter(Objects::nonNull)
|
||||
.map(PsiElement::getText).collect(Collectors.toList());
|
||||
.map(PsiElement::getText).toList();
|
||||
String expression = StringUtil.join(names, " | ");
|
||||
return CommonQuickFixBundle.message("fix.replace.with.x", expression);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.testIntegration.TestFramework;
|
||||
import com.intellij.testIntegration.TestIntegrationUtils;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import one.util.streamex.MoreCollectors;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -136,11 +138,9 @@ public class CreateTestAction extends PsiElementBaseIntentionAction {
|
||||
final HashSet<Module> modules = new HashSet<>();
|
||||
ModuleUtilCore.collectModulesDependsOn(productionModule, modules);
|
||||
modules.remove(productionModule);
|
||||
List<Module> modulesWithTestRoot = modules.stream()
|
||||
.filter(module -> !computeSuitableTestRootUrls(module).isEmpty())
|
||||
.limit(2)
|
||||
.collect(Collectors.toList());
|
||||
if (modulesWithTestRoot.size() == 1) return modulesWithTestRoot.get(0);
|
||||
Module moduleWithTestRoot = StreamEx.of(modules)
|
||||
.collect(MoreCollectors.onlyOne(module -> !computeSuitableTestRootUrls(module).isEmpty())).orElse(null);
|
||||
if (moduleWithTestRoot != null) return moduleWithTestRoot;
|
||||
}
|
||||
|
||||
return productionModule;
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ public class JSpecifyAnnotationTest extends LightJavaCodeInsightFixtureTestCase
|
||||
boolean dirMode = Files.isDirectory(path);
|
||||
List<Path> files = Files.walk(path)
|
||||
.filter(p -> Files.isRegularFile(p)).filter(p -> p.getFileName().toString().endsWith(".java"))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
if (files.isEmpty()) {
|
||||
throw new IllegalStateException("No Java files");
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ public class ClassInheritorsTest extends JavaCodeInsightFixtureTestCase {
|
||||
PsiClass n2 = (PsiClass)numberClass.getNavigationElement();
|
||||
assertTrue(String.valueOf(n2), n2 instanceof PsiClassImpl);
|
||||
Collection<PsiClass> subClasses = DirectClassInheritorsSearch.search(n2, GlobalSearchScope.allScope(getProject())).findAll();
|
||||
List<String> fqn = subClasses.stream().map(PsiClass::getQualifiedName).sorted().collect(Collectors.toList());
|
||||
List<String> fqn = subClasses.stream().map(PsiClass::getQualifiedName).sorted().toList();
|
||||
assertEquals(fqn.toString(), fqn.size(), new HashSet<>(fqn).size()); // no dups mean no Cls/Psi mixed
|
||||
|
||||
Collection<PsiClass> allSubClasses = ClassInheritorsSearch.search(n2, GlobalSearchScope.allScope(getProject()), true).findAll();
|
||||
List<String> allFqn = allSubClasses.stream().map(PsiClass::getQualifiedName).sorted().collect(Collectors.toList());
|
||||
List<String> allFqn = allSubClasses.stream().map(PsiClass::getQualifiedName).sorted().toList();
|
||||
assertEquals(allFqn.toString(), allFqn.size(), new HashSet<>(allFqn).size());
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ public class AnnotationsPanel {
|
||||
Object selectedItem = myCombo.getSelectedItem();
|
||||
List<String> newItems = Stream.concat(
|
||||
IntStream.range(0, count).mapToObj(myCombo::getItemAt),
|
||||
advancedAnnotations.stream()).sorted().distinct().collect(Collectors.toList());
|
||||
advancedAnnotations.stream()).sorted().distinct().toList();
|
||||
myCombo.removeAllItems();
|
||||
newItems.forEach(myCombo::addItem);
|
||||
myCombo.setSelectedItem(selectedItem);
|
||||
|
||||
@@ -579,7 +579,7 @@ public final class JsonSchemaAnnotatorChecker implements JsonValidationHost {
|
||||
|
||||
if (allTypes.size() == 1) return errors.iterator().next();
|
||||
|
||||
List<String> actualInfos = errors.stream().map(e -> e.getMessage()).map(JsonSchemaAnnotatorChecker::fetchActual).distinct().collect(Collectors.toList());
|
||||
List<String> actualInfos = errors.stream().map(e -> e.getMessage()).map(JsonSchemaAnnotatorChecker::fetchActual).distinct().toList();
|
||||
String actualInfo = actualInfos.size() == 1 ? (" " + JsonBundle.message("schema.validation.actual") + actualInfos.get(0) + ".") : "";
|
||||
String commonTypeMessage = JsonBundle.message("schema.validation.incompatible.types") + "\n" +
|
||||
JsonBundle.message("schema.validation.required.one.of",
|
||||
|
||||
@@ -147,7 +147,7 @@ public class JsonSchemaResolver {
|
||||
@Nullable
|
||||
private static JsonPropertyAdapter findProperty(@NotNull JsonObjectValueAdapter value, @NotNull String name) {
|
||||
List<JsonPropertyAdapter> list = value.getPropertyList();
|
||||
return list.stream().filter(p -> name.equals(p.getName())).findFirst().orElse(null);
|
||||
return ContainerUtil.find(list, p -> name.equals(p.getName()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -156,7 +156,7 @@ public class JsonSchemaResolver {
|
||||
boolean topLevelSchema) {
|
||||
final MatchResult matchResult = MatchResult.create(resolveRoot);
|
||||
List<JsonSchemaObject> schemas = new ArrayList<>(matchResult.mySchemas);
|
||||
schemas.addAll(matchResult.myExcludingSchemas.stream().flatMap(Collection::stream).collect(Collectors.toList()));
|
||||
schemas.addAll(matchResult.myExcludingSchemas.stream().flatMap(Collection::stream).toList());
|
||||
|
||||
final JsonSchemaObject firstSchema = getFirstValidSchema(schemas);
|
||||
if (element == null || schemas.size() == 1 || firstSchema == null) {
|
||||
|
||||
@@ -540,7 +540,7 @@ class JsonSchemaStatusWidget extends EditorBasedStatusBarPopup {
|
||||
.map(file -> jsonSchemaService.getSchemaProvider(file))
|
||||
.filter(Objects::nonNull)
|
||||
.map(provider -> Pair.create(SchemaType.userSchema.equals(provider.getSchemaType()), provider.getName()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
final long numOfSystemSchemas = pairList.stream().filter(pair -> !pair.getFirst()).count();
|
||||
// do not report anything if there is only one system schema and one user schema (user overrides schema that we provide)
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ public class DefaultInspectionToolResultExporter implements InspectionToolResult
|
||||
.filter(desc -> !isDescriptorExcluded.test(desc))
|
||||
.map(desc -> new ProblemDescriptorKey(desc))
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
for (ProblemDescriptorKey key : keys) {
|
||||
final var descriptor = key.descriptor;
|
||||
|
||||
+3
-5
@@ -341,11 +341,9 @@ final public class BuildDependenciesDownloader {
|
||||
new StringBuilder("Error downloading " + uri + ": non-200 http status code " + response.statusCode() + "\n");
|
||||
|
||||
Map<String, List<String>> headers = response.headers().map();
|
||||
for (String headerName : headers.keySet().stream().sorted().collect(Collectors.toList())) {
|
||||
for (String value : headers.get(headerName)) {
|
||||
builder.append("Header: ").append(headerName).append(": ").append(value).append("\n");
|
||||
}
|
||||
}
|
||||
headers.keySet().stream().sorted()
|
||||
.flatMap(headerName -> headers.get(headerName).stream().map(value -> "Header: " + headerName + ": " + value + "\n"))
|
||||
.forEach(builder::append);
|
||||
|
||||
builder.append("\n");
|
||||
if (Files.exists(tempFile)) {
|
||||
|
||||
+1
-1
@@ -426,7 +426,7 @@ public final class BuildDependenciesUtil {
|
||||
"Normalized entry name should not contain '" + doubleForwardSlashString + "': " + normalizedEntryName);
|
||||
}
|
||||
if (normalizedEntryName.contains("..") &&
|
||||
Arrays.stream(normalizedEntryName.split(forwardSlashString)).collect(Collectors.toList()).contains("..")) {
|
||||
Arrays.asList(normalizedEntryName.split(forwardSlashString)).contains("..")) {
|
||||
throw new IllegalStateException("Invalid entry name: " + normalizedEntryName);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ public class IntentionListStep implements ListPopupStep<IntentionActionWithTextC
|
||||
ApplicationManager.getApplication().invokeLater(() ->
|
||||
StackingPopupDispatcher.getInstance().getPopupStream()
|
||||
.filter(popup -> popup.getUserData(IntentionPreviewPopupUpdateProcessor.IntentionPreviewPopupKey.class) != null)
|
||||
.collect(Collectors.toList())
|
||||
.toList()
|
||||
.forEach(popup -> popup.cancel()));
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -286,8 +286,7 @@ public final class OfflineDescriptorResolveResult {
|
||||
};
|
||||
List<String> hints = offlineDescriptor.getHints();
|
||||
if (hints != null && entity instanceof RefModule) {
|
||||
List<QuickFix> fixes =
|
||||
hints.stream().map(hint -> wrapper.getTool().getQuickFix(hint)).filter(f -> f != null).collect(Collectors.toList());
|
||||
List<QuickFix> fixes = hints.stream().map(hint -> wrapper.getTool().getQuickFix(hint)).filter(f -> f != null).toList();
|
||||
return new ModuleProblemDescriptorImpl(ArrayUtil.append(fixes.toArray(QuickFix.EMPTY_ARRAY), rerunFix), offlineDescriptor.getDescription(), ((RefModule)entity).getModule());
|
||||
}
|
||||
return new CommonProblemDescriptorImpl(new QuickFix[]{rerunFix}, offlineDescriptor.getDescription());
|
||||
|
||||
+11
-11
@@ -16,6 +16,7 @@ import com.intellij.psi.codeStyle.MinusculeMatcher;
|
||||
import com.intellij.psi.codeStyle.NameUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -71,20 +72,19 @@ public class RecentFilesSEContributor extends FileSearchEverywhereContributor {
|
||||
ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(
|
||||
() -> {
|
||||
PsiManager psiManager = PsiManager.getInstance(myProject);
|
||||
Stream<VirtualFile> stream = history.stream();
|
||||
StreamEx<VirtualFile> stream = StreamEx.of(history);
|
||||
if (!StringUtil.isEmptyOrSpaces(searchString)) {
|
||||
stream = stream.filter(file -> matcher.matches(file.getName()));
|
||||
}
|
||||
res.addAll(stream.filter(vf -> !opened.contains(vf) && vf.isValid())
|
||||
.distinct()
|
||||
.map(vf -> {
|
||||
PsiFile f = psiManager.findFile(vf);
|
||||
String name = vf.getName();
|
||||
return f == null ? null : new FoundItemDescriptor<Object>(f, matcher.matchingDegree(name));
|
||||
})
|
||||
.filter(file -> file != null)
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
stream.filter(vf -> !opened.contains(vf) && vf.isValid())
|
||||
.distinct()
|
||||
.map(vf -> {
|
||||
PsiFile f = psiManager.findFile(vf);
|
||||
String name = vf.getName();
|
||||
return f == null ? null : new FoundItemDescriptor<Object>(f, matcher.matchingDegree(name));
|
||||
})
|
||||
.nonNull()
|
||||
.into(res);
|
||||
|
||||
ContainerUtil.process(res, consumer);
|
||||
}, progressIndicator);
|
||||
|
||||
+2
-8
@@ -299,10 +299,7 @@ public final class SearchEverywhereUI extends BigPopupUI implements DataProvider
|
||||
return IdeBundle.message("searcheverywhere.textfield.hint", SearchTopHitProvider.getTopHitAccelerator());
|
||||
}
|
||||
|
||||
List<String> advertisements = contributors.stream()
|
||||
.map(c -> c.getAdvertisement())
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
List<String> advertisements = ContainerUtil.mapNotNull(contributors, c -> c.getAdvertisement());
|
||||
|
||||
return advertisements.isEmpty() ? null : advertisements.get(new Random().nextInt(advertisements.size()));
|
||||
}
|
||||
@@ -749,10 +746,7 @@ public final class SearchEverywhereUI extends BigPopupUI implements DataProvider
|
||||
};
|
||||
|
||||
ShortcutSet selectShortcuts = ActionManager.getInstance().getAction(SearchEverywhereActions.SELECT_ITEM).getShortcutSet();
|
||||
Collection<KeyboardShortcut> keyboardShortcuts = Arrays.stream(selectShortcuts.getShortcuts())
|
||||
.filter(shortcut -> shortcut instanceof KeyboardShortcut)
|
||||
.map(shortcut -> (KeyboardShortcut)shortcut)
|
||||
.collect(Collectors.toList());
|
||||
Collection<KeyboardShortcut> keyboardShortcuts = ContainerUtil.filterIsInstance(selectShortcuts.getShortcuts(), KeyboardShortcut.class);
|
||||
|
||||
for (int modifiers : allowedModifiers) {
|
||||
Collection<Shortcut> newShortcuts = new ArrayList<>();
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleGrouper;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -49,10 +50,10 @@ public class MoveModuleToGroup extends ActionGroup {
|
||||
result.add(new MoveModulesToSubGroupAction(myModuleGroup));
|
||||
result.add(Separator.getInstance());
|
||||
ModuleGrouper grouper = ModuleGrouper.instanceFor(project, modifiableModuleModel);
|
||||
result.addAll(myModuleGroup.childGroups(grouper).stream().sorted((moduleGroup1, moduleGroup2) -> {
|
||||
assert moduleGroup1.getGroupPath().length == moduleGroup2.getGroupPath().length;
|
||||
return moduleGroup1.toString().compareToIgnoreCase(moduleGroup2.toString());
|
||||
}).map(MoveModuleToGroup::new).collect(Collectors.toList()));
|
||||
StreamEx.of(myModuleGroup.childGroups(grouper)).sorted((moduleGroup1, moduleGroup2) -> {
|
||||
assert moduleGroup1.getGroupPath().length == moduleGroup2.getGroupPath().length;
|
||||
return moduleGroup1.toString().compareToIgnoreCase(moduleGroup2.toString());
|
||||
}).map(MoveModuleToGroup::new).into(result);
|
||||
|
||||
return result.toArray(AnAction.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ final class DumpFormattingModelAction extends AnAction implements DumbAware {
|
||||
.map(documentWindow -> PsiDocumentManager.getInstance(project).getPsiFile(documentWindow))
|
||||
.filter(psi -> psi != null)
|
||||
.sorted(Comparator.comparingInt(psi -> injectedLanguageManager.injectedToHost(psi, psi.getTextRange()).getStartOffset()))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
for (PsiFile injectedFile : injectedFiles) {
|
||||
dumpModelForFile(injectedFile, output, injectedLanguageManager.injectedToHost(injectedFile, injectedFile.getTextRange()));
|
||||
|
||||
+1
-1
@@ -288,7 +288,7 @@ public class JavaHomeFinderBasic {
|
||||
var result = new HashSet<@NotNull String>();
|
||||
|
||||
try (Stream<Path> stream = Files.list(javasDir)) {
|
||||
List<Path> innerDirectories = stream.filter(d -> Files.isDirectory(d)).collect(Collectors.toList());
|
||||
List<Path> innerDirectories = stream.filter(d -> Files.isDirectory(d)).toList();
|
||||
for (Path innerDir : innerDirectories) {
|
||||
var home = innerDir;
|
||||
var releaseFile = home.resolve("release");
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class FragmentedSettingsEditor<Settings extends FragmentedSettin
|
||||
public void resetEditorFrom(@NotNull Settings settings) {
|
||||
super.resetEditorFrom(settings);
|
||||
List<FragmentedSettings.Option> options = settings.getSelectedOptions();
|
||||
for (SettingsEditorFragment<Settings, ?> fragment : getAllFragments().collect(Collectors.toList())) {
|
||||
for (SettingsEditorFragment<Settings, ?> fragment : getAllFragments().toList()) {
|
||||
FragmentedSettings.Option option = ContainerUtil.find(options, o -> fragment.getId().equals(o.getName()));
|
||||
fragment.setSelected(option == null ? fragment.isInitiallyVisible(settings) : option.getVisible());
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public abstract class FragmentedSettingsEditor<Settings extends FragmentedSettin
|
||||
@Override
|
||||
public void applyEditorTo(@NotNull Settings settings) throws ConfigurationException {
|
||||
super.applyEditorTo(settings);
|
||||
final var fragments = getAllFragments().collect(Collectors.toList());
|
||||
final var fragments = getAllFragments().toList();
|
||||
|
||||
fragments.forEach(f -> f.validate(settings));
|
||||
List<FragmentedSettings.Option> options = fragments.stream().filter(fragment -> (isDefaultSettings() || fragment.isCanBeHidden()) &&
|
||||
|
||||
@@ -106,7 +106,7 @@ public final class ConfirmingTrustManager extends ClientOnlyTrustManager {
|
||||
Arrays.stream(x509TrustManager.getAcceptedIssuers())
|
||||
.map(certificate -> certificate.getSubjectX500Principal().toString())
|
||||
.sorted()
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
LOG.debug("Accepted trusted certificate roots from the system: \n" + StringUtil.join(acceptedRoots, "\n"));
|
||||
|
||||
return x509TrustManager;
|
||||
|
||||
+1
-1
@@ -467,7 +467,7 @@ public final class LogLoadedApplicationClassesAgent {
|
||||
|
||||
@NotNull
|
||||
public List<String> generateReportWarnings() {
|
||||
List<ClassInfo> allInfos = myClasses.values().stream().sorted(Comparator.comparing(info -> info.name)).collect(Collectors.toList());
|
||||
List<ClassInfo> allInfos = myClasses.values().stream().sorted(Comparator.comparing(info -> info.name)).toList();
|
||||
|
||||
List<String> lines = new ArrayList<>();
|
||||
lines.add("Pre 1.6 classes:");
|
||||
|
||||
@@ -142,10 +142,7 @@ public final class RepositoryHelper {
|
||||
addMarketplacePluginDependencyIfRequired(node, isPaidPluginsRequireMarketplacePlugin);
|
||||
}
|
||||
|
||||
return result
|
||||
.values()
|
||||
.stream()
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
return List.copyOf(result.values());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -286,8 +286,7 @@ public class MultiSelectionEventHandler extends EventHandler {
|
||||
@Override
|
||||
public final @NotNull List<? extends ListPluginComponent> getSelection() {
|
||||
return myComponents.stream()
|
||||
.filter(component -> component.getSelection() == SelectionType.SELECTION)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
.filter(component -> component.getSelection() == SelectionType.SELECTION).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -98,7 +98,7 @@ final class PersistentFSConnector {
|
||||
if (traceNumeratorOps) {
|
||||
try (Stream<Path> files = Files.list(basePath)) {
|
||||
List<Path> nameEnumeratorFiles =
|
||||
files.filter(p -> p.getFileName().toString().startsWith(namesFile.getFileName().toString())).collect(Collectors.toList());
|
||||
files.filter(p -> p.getFileName().toString().startsWith(namesFile.getFileName().toString())).toList();
|
||||
LOG.info("Existing name enumerator files: " + nameEnumeratorFiles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ package com.intellij.internal;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
@@ -17,16 +18,13 @@ public class DumpTestEnvironmentTest {
|
||||
@Test
|
||||
public void dumpEnvironment() throws Exception {
|
||||
Properties properties = System.getProperties();
|
||||
for (String propertyName : properties.keySet().stream().map(String.class::cast).sorted().collect(Collectors.toList())) {
|
||||
System.out.println("PROPERTY " + propertyName + " = " +
|
||||
(isSecretParameter(propertyName) ? "[REDACTED]" : properties.getProperty(propertyName)));
|
||||
StreamEx.ofKeys(properties).map(String.class::cast).sorted()
|
||||
.map(propertyName -> "PROPERTY " + propertyName + " = " + (isSecretParameter(propertyName) ? "[REDACTED]" : properties.getProperty(propertyName)))
|
||||
.forEach(System.out::println);
|
||||
|
||||
}
|
||||
|
||||
for (String key : System.getenv().keySet().stream().sorted().collect(Collectors.toList())) {
|
||||
System.out.println("ENV " + key + " = " +
|
||||
(isSecretParameter(key) ? "[REDACTED]" : System.getenv(key)));
|
||||
}
|
||||
StreamEx.ofKeys(System.getenv()).sorted()
|
||||
.map(key -> "ENV " + key + " = " + (isSecretParameter(key) ? "[REDACTED]" : System.getenv(key)))
|
||||
.forEach(System.out::println);
|
||||
|
||||
System.out.println("*** Classloaders NOT SORTED CLASSPATH ***");
|
||||
dumpClassloader(getClass().getClassLoader(), false, 0);
|
||||
|
||||
@@ -85,7 +85,7 @@ package com.intellij.util;
|
||||
Set<Thread> used = ContainerUtil.newConcurrentSet();
|
||||
AtomicInteger executed = new AtomicInteger();
|
||||
int N = 100000;
|
||||
List<Alarm> alarms = Stream.generate(() -> new Alarm(getTestRootDisposable())).limit(N).collect(Collectors.toList());
|
||||
List<Alarm> alarms = Stream.generate(() -> new Alarm(getTestRootDisposable())).limit(N).toList();
|
||||
alarms.forEach(alarm -> alarm.addRequest(() -> {
|
||||
executed.incrementAndGet();
|
||||
used.add(Thread.currentThread());
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ public class AppScheduledExecutorServiceTest extends CatchLogErrorsInAllThreadsT
|
||||
|
||||
Future<?> f4 = service.submit((Runnable)() -> log.add(new LogInfo(0)));
|
||||
|
||||
assertTrue(f.stream().noneMatch(Future::isDone));
|
||||
assertFalse(ContainerUtil.exists(f, Future::isDone));
|
||||
|
||||
TimeoutUtil.sleep(delay/2);
|
||||
Stream<Pair<? extends ScheduledFuture<?>, Boolean>> done = f.stream().map(f1 -> Pair.create(f1, f1.isDone()));
|
||||
|
||||
+1
-1
@@ -52,7 +52,7 @@ public class BoundedTaskExecutorTest extends CatchLogErrorsInAllThreadsTestCase
|
||||
.filter(thread -> thread.getName().startsWith(AppScheduledExecutorService.POOLED_THREAD_PREFIX))
|
||||
.filter(thread -> thread.getState() == Thread.State.RUNNABLE)
|
||||
.filter(thread -> thread.getStackTrace().length != 0) // there can be RUNNABLE zombies with empty stacktrace
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
long finish = System.currentTimeMillis();
|
||||
if (alive.isEmpty()) break;
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
|
||||
.map(nextForProject -> nextForProject.findManager(deployment))
|
||||
.filter(Objects::nonNull)
|
||||
.map(DeploymentLogManagerImpl::getMainLoggingHandler)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
final Consumer<String> logConsumer = message -> {
|
||||
if (handlers.isEmpty()) {
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -50,8 +51,8 @@ public class ImportTestsGroup extends ActionGroup {
|
||||
final List<File> fileNames = filePaths.stream()
|
||||
.map(fileName -> new File(testHistoryRoot, fileName))
|
||||
.filter(file -> file.exists())
|
||||
.sorted((f1, f2) -> Long.compare(f2.lastModified(), f1.lastModified()))
|
||||
.collect(Collectors.toList());
|
||||
.sorted(Comparator.comparingLong(File::lastModified).reversed())
|
||||
.toList();
|
||||
final int historySize = fileNames.size();
|
||||
final AnAction[] actions = new AnAction[historySize];
|
||||
for (int i = 0; i < historySize; i++) {
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ public final class ShortcutDataProvider {
|
||||
private static String getLocaleUnawareKeyModifiersText(int modifiers) {
|
||||
List<String> pressed = ourModifiers.stream()
|
||||
.filter(p -> (p.first & modifiers) != 0)
|
||||
.map(p -> p.second).collect(Collectors.toList());
|
||||
.map(p -> p.second).toList();
|
||||
return StringUtil.join(pressed, "+");
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,7 @@ public final class Retries {
|
||||
private static Optional<Method> getMethodFromClass(Class<?> clazz, String methodName) {
|
||||
@SuppressWarnings("SSBasedInspection")
|
||||
var methods = Arrays.stream(clazz.getDeclaredMethods())
|
||||
.filter(method -> methodName.equals(method.getName()))
|
||||
.collect(Collectors.toList());
|
||||
.filter(method -> methodName.equals(method.getName())).toList();
|
||||
if (methods.size() == 1) {
|
||||
return Optional.of(methods.get(0));
|
||||
}
|
||||
|
||||
@@ -820,7 +820,7 @@ public final class EditorTestUtil {
|
||||
Pair.create(it.getEndOffset(), "</" + keyText + ">")
|
||||
);
|
||||
})
|
||||
.sorted(MARKERS_COMPARATOR).collect(Collectors.toList());
|
||||
.sorted(MARKERS_COMPARATOR).toList();
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int lastEnd = 0;
|
||||
|
||||
+1
-2
@@ -550,8 +550,7 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
new ExpectedHighlightingData(document, checkWarnings, checkWeakWarnings, checkInfos, false, myMessageBundles);
|
||||
datum.init();
|
||||
return Trinity.create(psiFile, createEditor(file), datum);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}).toList();
|
||||
long elapsed = 0;
|
||||
for (Trinity<PsiFile, Editor, ExpectedHighlightingData> trinity : data) {
|
||||
setFileAndEditor(trinity.first.getVirtualFile(), trinity.second);
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ public class ReformatCommitMessageAction extends DumbAwareAction {
|
||||
|
||||
@RequiresWriteLock
|
||||
public static void reformat(@NotNull Project project, @NotNull Document document) {
|
||||
List<BaseCommitMessageInspection> inspections = getEnabledInspections(project).collect(toList());
|
||||
List<BaseCommitMessageInspection> inspections = getEnabledInspections(project).toList();
|
||||
|
||||
inspections.forEach(inspection -> inspection.reformat(project, document));
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class VcsLogImpl implements VcsLog {
|
||||
SettableFuture<Boolean> future = SettableFuture.create();
|
||||
VcsLogRefs refs = myUi.getDataPack().getRefs();
|
||||
ApplicationManager.getApplication().executeOnPooledThread(() -> {
|
||||
List<VcsRef> matchingRefs = refs.stream().filter(ref -> ref.getName().startsWith(reference)).collect(Collectors.toList());
|
||||
List<VcsRef> matchingRefs = refs.stream().filter(ref -> ref.getName().startsWith(reference)).toList();
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
if (matchingRefs.isEmpty()) {
|
||||
future.setFuture(jumpToHash(reference, focus));
|
||||
|
||||
+1
-1
@@ -366,7 +366,7 @@ public final class ClassUtils {
|
||||
.filter(innerClass -> innerClass.hasModifierProperty(PsiModifier.STATIC))
|
||||
.flatMap(innerClass -> Arrays.stream(innerClass.getFields())));
|
||||
|
||||
final List<PsiField> fields = fieldStream.filter(field -> resolveToSingletonField(aClass, field)).limit(2).collect(Collectors.toList());
|
||||
final List<PsiField> fields = fieldStream.filter(field -> resolveToSingletonField(aClass, field)).limit(2).toList();
|
||||
return fields.size() == 1 ? fields.get(0) : null;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -501,7 +501,7 @@ public class MismatchedCollectionQueryUpdateInspection extends BaseInspection {
|
||||
if (written) {
|
||||
PsiExpression initializer = variable.getInitializer();
|
||||
if (initializer != null) {
|
||||
List<PsiExpression> expressions = ExpressionUtils.nonStructuralChildren(initializer).collect(Collectors.toList());
|
||||
List<PsiExpression> expressions = ExpressionUtils.nonStructuralChildren(initializer).toList();
|
||||
if (!ContainerUtil.and(expressions, MismatchedCollectionQueryUpdateInspection::isCollectionInitializer)) {
|
||||
expressions.stream().filter(MismatchedCollectionQueryUpdateInspection::isCollectionInitializer)
|
||||
.forEach(emptyCollection -> registerError(emptyCollection, Boolean.TRUE));
|
||||
|
||||
+2
-2
@@ -125,13 +125,13 @@ public class EditorConfigSettingsWriter extends OutputStreamWriter {
|
||||
}
|
||||
}
|
||||
});
|
||||
for (String pattern : mappers.keySet().stream().sorted().collect(Collectors.toList())) {
|
||||
for (String pattern : mappers.keySet().stream().sorted().toList()) {
|
||||
if (pattern.isEmpty()) continue;
|
||||
String currPattern = pattern;
|
||||
for (
|
||||
LanguageCodeStylePropertyMapper mapper :
|
||||
mappers.get(pattern).stream()
|
||||
.sorted(Comparator.comparing(mapper -> mapper.getLanguageDomainId())).collect(Collectors.toList())) {
|
||||
.sorted(Comparator.comparing(mapper -> mapper.getLanguageDomainId())).toList()) {
|
||||
if (writeLangSection(mapper, currPattern)) {
|
||||
currPattern = null; // Do not write again
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class GradleDelegatedBuildTest extends GradleDelegatedBuildTestCase {
|
||||
@Override
|
||||
public void finished(@NotNull ProjectTaskManager.Result result) {
|
||||
result.getContext().getDirtyOutputPaths()
|
||||
.ifPresent(paths -> dirtyOutputRoots.addAll(paths.map(PathUtil::toSystemIndependentName).collect(Collectors.toList())));
|
||||
.ifPresent(paths -> dirtyOutputRoots.addAll(paths.map(PathUtil::toSystemIndependentName).toList()));
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ public class GradleTaskManager implements ExternalSystemTaskManager<GradleExecut
|
||||
@NotNull GradleExecutionSettings effectiveSettings,
|
||||
@Nullable String gradleVersion) {
|
||||
final List<String> initScripts = new ArrayList<>();
|
||||
List<GradleProjectResolverExtension> extensions = GradleProjectResolverUtil.createProjectResolvers(null).collect(Collectors.toList());
|
||||
List<GradleProjectResolverExtension> extensions = GradleProjectResolverUtil.createProjectResolvers(null).toList();
|
||||
for (GradleProjectResolverExtension resolverExtension : extensions) {
|
||||
final String resolverClassName = resolverExtension.getClass().getName();
|
||||
Consumer<String> initScriptConsumer = script -> {
|
||||
|
||||
@@ -219,7 +219,7 @@ public final class GradleUtil {
|
||||
try (Stream<Path> pathsStream = Files.list(wrapperDir)) {
|
||||
List<Path> candidates = pathsStream
|
||||
.filter(path -> FileUtilRt.extensionEquals(path.getFileName().toString(), "properties") && Files.isRegularFile(path))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (candidates.isEmpty()) {
|
||||
GradleLog.LOG.warn("No *.properties file is found at the gradle wrapper directory " + wrapperDir);
|
||||
|
||||
@@ -139,7 +139,7 @@ public final class HgHistoryUtil {
|
||||
|
||||
HgRevisionNumber vcsRevisionNumber = revision.getRevisionNumber();
|
||||
List<? extends HgRevisionNumber> parents = vcsRevisionNumber.getParents();
|
||||
for (HgRevisionNumber parent : parents.stream().skip(1).collect(Collectors.toList())) {
|
||||
for (HgRevisionNumber parent : parents.stream().skip(1).toList()) {
|
||||
reportedChanges.add(getChangesFromParent(project, root, vcsRevisionNumber, parent));
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ final class SceneBuilderUtil {
|
||||
.filter(path -> {
|
||||
String name = path.toFile().getName();
|
||||
return name.startsWith(artifact + "-" + JAVAFX_VERSION) && name.endsWith(".jar"); //include os-specific jars
|
||||
}).collect(Collectors.toList());
|
||||
}).toList();
|
||||
|
||||
for (Path path : paths) {
|
||||
urls.add(path.toUri().toURL());
|
||||
|
||||
+2
-4
@@ -182,12 +182,10 @@ public abstract class AbstractLombokParsingTestCase extends AbstractLombokLightC
|
||||
Collection<String> beforeAnnotations = Arrays.stream(beforeModifierList.getAnnotations())
|
||||
.map(PsiAnnotation::getQualifiedName)
|
||||
.filter(Pattern.compile("lombok.*").asPredicate().negate().or(LombokClassNames.NON_NULL::equals))
|
||||
.filter(Pattern.compile(annotationToComparePattern()).asPredicate())
|
||||
.collect(Collectors.toList());
|
||||
.filter(Pattern.compile(annotationToComparePattern()).asPredicate()).toList();
|
||||
Collection<String> afterAnnotations = Arrays.stream(afterModifierList.getAnnotations())
|
||||
.map(PsiAnnotation::getQualifiedName)
|
||||
.filter(Pattern.compile(annotationToComparePattern()).asPredicate())
|
||||
.collect(Collectors.toList());
|
||||
.filter(Pattern.compile(annotationToComparePattern()).asPredicate()).toList();
|
||||
|
||||
assertTrue("Annotations are different for " + afterModifierList.getParent(),
|
||||
beforeAnnotations.size() == afterAnnotations.size()
|
||||
|
||||
+1
-1
@@ -221,7 +221,7 @@ public class MavenRunnerPanel implements MavenSettingsObservable {
|
||||
if (!localTarget) {
|
||||
List<String> items = IntStream.range(0, myTargetJdkCombo.getItemCount())
|
||||
.mapToObj(i -> myTargetJdkCombo.getItemAt(i))
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
List<String> targetItems = new ArrayList<>();
|
||||
TargetEnvironmentConfiguration targetEnvironmentConfiguration = TargetEnvironmentsManager.getInstance(myProject)
|
||||
|
||||
+1
-1
@@ -791,7 +791,7 @@ public class MavenProjectsManager extends MavenSimpleProjectComponent
|
||||
return VirtualFileManager.getInstance().findFileByUrl(pomFileUrl);
|
||||
}
|
||||
for (VirtualFile root : modelsProvider.getContentRoots(module)) {
|
||||
List<VirtualFile> pomFiles = MavenUtil.streamPomFiles(module.getProject(), root).collect(Collectors.toList());
|
||||
List<VirtualFile> pomFiles = MavenUtil.streamPomFiles(module.getProject(), root).toList();
|
||||
if (pomFiles.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import com.intellij.util.containers.Stack;
|
||||
import com.intellij.util.io.PathKt;
|
||||
import it.unimi.dsi.fastutil.Hash;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectOpenCustomHashSet;
|
||||
import one.util.streamex.MoreCollectors;
|
||||
import one.util.streamex.StreamEx;
|
||||
import org.jdom.Element;
|
||||
import org.jdom.output.Format;
|
||||
import org.jdom.output.XMLOutputter;
|
||||
@@ -1064,11 +1066,10 @@ public final class MavenProjectsTree {
|
||||
public MavenProject findSingleProjectInReactor(MavenId id) {
|
||||
readLock();
|
||||
try {
|
||||
List<MavenProject> list = myMavenIdToProjectMapping.values().stream().filter(
|
||||
it -> StringUtil.equals(it.getMavenId().getArtifactId(), id.getArtifactId()) &&
|
||||
StringUtil.equals(it.getMavenId().getGroupId(), id.getGroupId())
|
||||
).collect(Collectors.toList());
|
||||
return list.size() == 1 ? list.get(0) : null;
|
||||
return StreamEx.ofValues(myMavenIdToProjectMapping)
|
||||
.collect(MoreCollectors.onlyOne(it -> StringUtil.equals(it.getMavenId().getArtifactId(), id.getArtifactId()) &&
|
||||
StringUtil.equals(it.getMavenId().getGroupId(), id.getGroupId())))
|
||||
.orElse(null);
|
||||
}
|
||||
finally {
|
||||
readUnlock();
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class MavenWrapperTestFixture {
|
||||
.flatMap(e -> e.getChildren().stream())
|
||||
.filter(e -> "snapshot".equals(e.getName()))
|
||||
.flatMap(e -> e.getChildren().stream())
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
String timestamp = null;
|
||||
String build = null;
|
||||
for(Element e: timestampAndBuild){
|
||||
|
||||
@@ -77,7 +77,7 @@ public class VSCBundle extends Bundle {
|
||||
if (extensions instanceof ArrayList) {
|
||||
//noinspection unchecked
|
||||
Stream<String> stream = ((ArrayList)extensions).stream().map(ext -> Strings.trimStart((String)ext, "."));
|
||||
idToExtension.computeIfAbsent((String)id, (key) -> new HashSet<>()).addAll(stream.collect(Collectors.toList()));
|
||||
idToExtension.computeIfAbsent((String)id, (key) -> new HashSet<>()).addAll(stream.toList());
|
||||
}
|
||||
Object filenames = ((Map<?, ?>)language).get("filenames");
|
||||
if (filenames instanceof ArrayList) {
|
||||
|
||||
+1
-2
@@ -253,8 +253,7 @@ public final class TextMateLexer {
|
||||
if (captures != null) {
|
||||
List<CaptureMatchData> matches = SyntaxMatchUtils.matchCaptures(captures, matchData, string, line);
|
||||
//noinspection SSBasedInspection
|
||||
List<CaptureMatchData> nonEmptyMatches = matches.stream().filter(m -> m.selectorName.length() > 0 && !m.range.isEmpty())
|
||||
.collect(Collectors.toList());
|
||||
List<CaptureMatchData> nonEmptyMatches = matches.stream().filter(m -> m.selectorName.length() > 0 && !m.range.isEmpty()).toList();
|
||||
LinkedList<CaptureMatchData> starts = new LinkedList<>(nonEmptyMatches);
|
||||
Collections.sort(starts, CaptureMatchData.START_OFFSET_ORDERING);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.intellij.openapi.editor.CaretModel;
|
||||
import com.intellij.openapi.ide.CopyPasteManager;
|
||||
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
|
||||
import com.intellij.ui.components.breadcrumbs.Crumb;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.yaml.YAMLBundle;
|
||||
|
||||
@@ -38,9 +39,7 @@ public class YAMLBreadcrumbsTest extends BasePlatformTestCase {
|
||||
private void doTest(@NotNull Function<? super Crumb, String> crumbToString) {
|
||||
myFixture.configureByFile("all.yml");
|
||||
final CaretModel caretModel = myFixture.getEditor().getCaretModel();
|
||||
final String result = caretModel.getAllCarets().stream()
|
||||
.map(Caret::getOffset)
|
||||
.collect(Collectors.toList()).stream()
|
||||
final String result = ContainerUtil.map(caretModel.getAllCarets(), Caret::getOffset).stream()
|
||||
.map((offset) -> {
|
||||
caretModel.moveToOffset(offset);
|
||||
return myFixture.getBreadcrumbsAtCaret().stream()
|
||||
|
||||
+3
-4
@@ -30,6 +30,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -132,14 +133,12 @@ public class PyOperatorReference extends PyReferenceImpl {
|
||||
PyTypeUtil
|
||||
.toStream(type)
|
||||
.nonNull()
|
||||
.map(
|
||||
.flatCollection(
|
||||
it -> it instanceof PyClassLikeType && ((PyClassLikeType)it).isDefinition()
|
||||
? resolveDefinitionMember((PyClassLikeType)it, object, name)
|
||||
: it.resolveMember(name, object, AccessDirection.of(myElement), myContext)
|
||||
)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(List::stream)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
|
||||
if (!ContainerUtil.isEmpty(res)) {
|
||||
results.addAll(res);
|
||||
|
||||
@@ -192,7 +192,7 @@ public final class PyPackageManagerUI {
|
||||
req -> ContainerUtil.map(req.getInstallOptions(), option -> Pair.create(option, req.getName()))) : null;
|
||||
final List<String> packageManagerArguments = exceptions.stream()
|
||||
.flatMap(e -> (e instanceof PyExecutionException) ? ((PyExecutionException)e).getArgs().stream() : null)
|
||||
.collect(Collectors.toList());
|
||||
.toList();
|
||||
final String packageNames = requirements != null ? requirements.stream()
|
||||
.filter(req -> packageManagerArguments.contains(req.first))
|
||||
.map(req -> req.second)
|
||||
|
||||
@@ -190,10 +190,7 @@ public class PyOverrideTest extends PyTestCase {
|
||||
final String importFilePath = String.format("override/%s_import.py", testName);
|
||||
final String resultFilePath = String.format("override/%s_after.py", testName);
|
||||
|
||||
List<PyFile> pyFiles = Arrays.stream(
|
||||
myFixture.configureByFiles(initialFilePath, importFilePath))
|
||||
.map(PyFile.class::cast)
|
||||
.collect(Collectors.toList());
|
||||
List<PyFile> pyFiles = ContainerUtil.map(myFixture.configureByFiles(initialFilePath, importFilePath), PyFile.class::cast);
|
||||
|
||||
PyFunction toOverride = pyFiles.get(1).getTopLevelClasses().get(orderOfClassToOverride).getMethods()[0];
|
||||
PyOverrideImplementUtil.overrideMethods(myFixture.getEditor(), getTopLevelClass(0),
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class HtmlMissingClosingTagInspectionTest extends BasePlatformTestCase {
|
||||
protected IntentionAction findIntention(@NotNull final String hint) {
|
||||
final List<IntentionAction> allIntentions = myFixture.getAvailableIntentions();
|
||||
final List<IntentionAction> intentions =
|
||||
allIntentions.stream().filter(action -> action.getText().startsWith(hint)).limit(2).collect(Collectors.toList());
|
||||
allIntentions.stream().filter(action -> action.getText().startsWith(hint)).limit(2).toList();
|
||||
Assert.assertFalse("\"" + hint + "\" not in " + intentions, intentions.isEmpty());
|
||||
Assert.assertFalse("Too many quickfixes found for \"" + hint + "\": " + intentions + "]", intentions.size() > 1);
|
||||
return intentions.get(0);
|
||||
|
||||
@@ -55,7 +55,7 @@ public abstract class BaseHtmlLexer extends DelegateLexer {
|
||||
.map(factory -> factory.createEmbeddedContentProviders(this))
|
||||
.flatMap(Collection::stream)
|
||||
.filter(this::acceptEmbeddedContentProvider)
|
||||
.collect(Collectors.toUnmodifiableList());
|
||||
.toList();
|
||||
myTagEmbedmentStartTokens = createTagEmbedmentStartTokenSet();
|
||||
myAttributeEmbedmentTokens = createAttributeEmbedmentTokenSet();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user