mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-05 01:50:56 +07:00
Java: better quick fix texts for "Loop can be collapsed with Stream API" and "Simplifiable forEach() call" inspections
GitOrigin-RevId: c4db6507c258e5611f6d47b9373a0c2531802345
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5be155b243
commit
86f0b63857
@@ -379,6 +379,7 @@ replace.operator.assignment.with.assignment=Replace Operator Assignment with Ass
|
||||
replace.stringtokenizer.delimiters.parameter.with.unique.symbols=Remove duplication from 'delimiters' argument
|
||||
replace.var.with.explicit.type=Replace 'var' with explicit type
|
||||
replace.with.0=Replace with {0}
|
||||
replace.with.stream.api.fix=Collapse loop with stream ''{0}()''
|
||||
replace.with.comparator=Replace with comparator
|
||||
replace.with.constant.value=Replace with constant value
|
||||
replace.with.expression.lambda=Replace with expression lambda
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.streamMigration;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -25,7 +11,7 @@ import static com.intellij.codeInspection.streamMigration.OperationReductionMigr
|
||||
class CountMigration extends BaseStreamApiMigration {
|
||||
|
||||
CountMigration(boolean shouldWarn) {
|
||||
super(shouldWarn, "count()");
|
||||
super(shouldWarn, "count");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.streamMigration;
|
||||
|
||||
import com.intellij.codeInsight.ExpressionUtil;
|
||||
@@ -17,15 +17,16 @@ import org.jetbrains.annotations.NotNull;
|
||||
import static com.intellij.util.ObjectUtils.tryCast;
|
||||
|
||||
class FindFirstMigration extends BaseStreamApiMigration {
|
||||
FindFirstMigration(boolean shouldWarn) {super(shouldWarn, "findFirst()");}
|
||||
FindFirstMigration(boolean shouldWarn) {
|
||||
super(shouldWarn, "findFirst");
|
||||
}
|
||||
|
||||
@Override
|
||||
PsiElement migrate(@NotNull Project project, @NotNull PsiElement body, @NotNull TerminalBlock tb) {
|
||||
PsiStatement statement = tb.getSingleStatement();
|
||||
PsiStatement loopStatement = tb.getStreamSourceStatement();
|
||||
CommentTracker ct = new CommentTracker();
|
||||
if (statement instanceof PsiReturnStatement) {
|
||||
PsiReturnStatement returnStatement = (PsiReturnStatement)statement;
|
||||
if (statement instanceof PsiReturnStatement returnStatement) {
|
||||
PsiExpression value = returnStatement.getReturnValue();
|
||||
if (value == null) return null;
|
||||
PsiReturnStatement nextReturnStatement = ControlFlowUtils.getNextReturnStatement(loopStatement);
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.streamMigration;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -28,15 +14,14 @@ class MatchMigration extends BaseStreamApiMigration {
|
||||
private static final Logger LOG = Logger.getInstance(MatchMigration.class);
|
||||
|
||||
MatchMigration(boolean shouldWarn, String methodName) {
|
||||
super(shouldWarn, methodName+"()");
|
||||
super(shouldWarn, methodName);
|
||||
}
|
||||
|
||||
@Override
|
||||
PsiElement migrate(@NotNull Project project, @NotNull PsiElement body, @NotNull TerminalBlock tb) {
|
||||
PsiStatement sourceStatement = tb.getStreamSourceStatement();
|
||||
CommentTracker ct = new CommentTracker();
|
||||
if(tb.getSingleStatement() instanceof PsiReturnStatement) {
|
||||
PsiReturnStatement returnStatement = (PsiReturnStatement)tb.getSingleStatement();
|
||||
if(tb.getSingleStatement() instanceof PsiReturnStatement returnStatement) {
|
||||
PsiLiteralExpression literal = ObjectUtils.tryCast(PsiUtil.skipParenthesizedExprDown(returnStatement.getReturnValue()),
|
||||
PsiLiteralExpression.class);
|
||||
if (literal != null && literal.getValue() instanceof Boolean) {
|
||||
@@ -76,11 +61,10 @@ class MatchMigration extends BaseStreamApiMigration {
|
||||
PsiExpression rValue = assignment.getRExpression();
|
||||
if ((lValue instanceof PsiReferenceExpression) && rValue != null) {
|
||||
PsiElement maybeVar = ((PsiReferenceExpression)lValue).resolve();
|
||||
if (maybeVar instanceof PsiVariable) {
|
||||
if (maybeVar instanceof PsiVariable var) {
|
||||
// Simplify single assignments like this:
|
||||
// boolean flag = false;
|
||||
// for(....) if(...) {flag = true; break;}
|
||||
PsiVariable var = (PsiVariable)maybeVar;
|
||||
PsiExpression initializer = var.getInitializer();
|
||||
InitializerUsageStatus status = ControlFlowUtils.getInitializerUsageStatus(var, sourceStatement);
|
||||
if (initializer != null && status != ControlFlowUtils.InitializerUsageStatus.UNKNOWN) {
|
||||
@@ -111,15 +95,13 @@ class MatchMigration extends BaseStreamApiMigration {
|
||||
@NotNull TerminalBlock tb) {
|
||||
String origStream = tb.generate(ct);
|
||||
PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(contextElement.getProject());
|
||||
PsiExpression stream = elementFactory.createExpressionFromText(origStream, contextElement);
|
||||
LOG.assertTrue(stream instanceof PsiMethodCallExpression);
|
||||
PsiElement nameElement = ((PsiMethodCallExpression)stream).getMethodExpression().getReferenceNameElement();
|
||||
PsiMethodCallExpression stream = (PsiMethodCallExpression)elementFactory.createExpressionFromText(origStream, contextElement);
|
||||
PsiElement nameElement = stream.getMethodExpression().getReferenceNameElement();
|
||||
if (nameElement != null && nameElement.getText().equals("filter")) {
|
||||
if (methodName.equals("noneMatch")) {
|
||||
// Try to reduce noneMatch(x -> !(condition)) to allMatch(x -> condition)
|
||||
PsiExpression[] expressions = ((PsiMethodCallExpression)stream).getArgumentList().getExpressions();
|
||||
if (expressions.length == 1 && expressions[0] instanceof PsiLambdaExpression) {
|
||||
PsiLambdaExpression lambda = (PsiLambdaExpression)expressions[0];
|
||||
PsiExpression[] expressions = stream.getArgumentList().getExpressions();
|
||||
if (expressions.length == 1 && expressions[0] instanceof PsiLambdaExpression lambda) {
|
||||
PsiElement lambdaBody = lambda.getBody();
|
||||
if (lambdaBody instanceof PsiExpression && BoolUtils.isNegation((PsiExpression)lambdaBody)) {
|
||||
PsiExpression negated = BoolUtils.getNegated((PsiExpression)lambdaBody);
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.streamMigration;
|
||||
|
||||
import com.intellij.codeInsight.intention.FileModifier;
|
||||
@@ -45,7 +31,7 @@ class MigrateToStreamFix implements LocalQuickFix {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return JavaAnalysisBundle.message("replace.with.0", myMigration.getReplacement());
|
||||
return JavaAnalysisBundle.message("replace.with.stream.api.fix", myMigration.getReplacement());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -86,17 +72,14 @@ class MigrateToStreamFix implements LocalQuickFix {
|
||||
private static void removeRedundantPatternVariables(PsiElement element) {
|
||||
for (PsiLambdaExpression lambda : PsiTreeUtil.collectElementsOfType(element, PsiLambdaExpression.class)) {
|
||||
PsiElement body = lambda.getBody();
|
||||
if (body instanceof PsiExpression) {
|
||||
PsiExpression expression = (PsiExpression)body;
|
||||
if (PsiType.BOOLEAN.equals(expression.getType())) {
|
||||
List<PsiPatternVariable> variables = JavaPsiPatternUtil.getExposedPatternVariablesIgnoreParent(expression);
|
||||
for (PsiPatternVariable variable : variables) {
|
||||
if (variable.getPattern() instanceof PsiTypeTestPattern pattern && pattern.getParent() instanceof PsiDeconstructionList) {
|
||||
continue;
|
||||
}
|
||||
if (!VariableAccessUtils.variableIsUsed(variable, expression)) {
|
||||
variable.delete();
|
||||
}
|
||||
if (body instanceof PsiExpression expression && PsiType.BOOLEAN.equals(expression.getType())) {
|
||||
List<PsiPatternVariable> variables = JavaPsiPatternUtil.getExposedPatternVariablesIgnoreParent(expression);
|
||||
for (PsiPatternVariable variable : variables) {
|
||||
if (variable.getPattern() instanceof PsiTypeTestPattern pattern && pattern.getParent() instanceof PsiDeconstructionList) {
|
||||
continue;
|
||||
}
|
||||
if (!VariableAccessUtils.variableIsUsed(variable, expression)) {
|
||||
variable.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.streamMigration;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -29,14 +15,13 @@ import java.util.Locale;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Created by Roman Ivanov.
|
||||
* @author Roman Ivanov.
|
||||
*/
|
||||
public class OperationReductionMigration extends BaseStreamApiMigration {
|
||||
private final ReductionOperation myReductionOperation;
|
||||
|
||||
protected OperationReductionMigration(boolean shouldWarn,
|
||||
ReductionOperation context) {
|
||||
super(shouldWarn, "reduce()");
|
||||
protected OperationReductionMigration(boolean shouldWarn, ReductionOperation context) {
|
||||
super(shouldWarn, "reduce");
|
||||
myReductionOperation = context;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.streamMigration;
|
||||
|
||||
import com.intellij.codeInsight.intention.FileModifier;
|
||||
@@ -61,7 +61,7 @@ public class SimplifyForEachInspection extends AbstractBaseJavaLocalInspectionTo
|
||||
boolean lastOpChanged = !(context.myMigration instanceof ForEachMigration);
|
||||
if (opCountChanged || lastOpChanged) {
|
||||
String customMessage = lastOpChanged ?
|
||||
JavaBundle.message("inspection.simplify.for.each.replace", context.myMigration.getReplacement()) :
|
||||
CommonQuickFixBundle.message("fix.replace.with.x", context.myMigration.getReplacement() + "()") :
|
||||
JavaBundle.message("inspection.simplify.for.each.extract.intermediate.operations");
|
||||
ProblemHighlightType highlightType = ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
|
||||
holder.registerProblem(context.myMainStatement, customMessage, highlightType, getRange(call).shiftRight(-call.getTextOffset()),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.streamMigration;
|
||||
|
||||
import com.intellij.codeInsight.ExceptionUtil;
|
||||
@@ -94,11 +94,9 @@ public class StreamApiMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
@Contract("null, null -> true; null, !null -> false")
|
||||
private static boolean sameReference(PsiExpression expr1, PsiExpression expr2) {
|
||||
if (expr1 == null && expr2 == null) return true;
|
||||
if (!(expr1 instanceof PsiReferenceExpression) || !(expr2 instanceof PsiReferenceExpression)) return false;
|
||||
PsiReferenceExpression ref1 = (PsiReferenceExpression)expr1;
|
||||
PsiReferenceExpression ref2 = (PsiReferenceExpression)expr2;
|
||||
return Objects.equals(ref1.getReferenceName(), ref2.getReferenceName()) && sameReference(ref1.getQualifierExpression(),
|
||||
ref2.getQualifierExpression());
|
||||
if (!(expr1 instanceof PsiReferenceExpression ref1) || !(expr2 instanceof PsiReferenceExpression ref2)) return false;
|
||||
return Objects.equals(ref1.getReferenceName(), ref2.getReferenceName()) &&
|
||||
sameReference(ref1.getQualifierExpression(), ref2.getQualifierExpression());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,8 +117,7 @@ public class StreamApiMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
return assignment.getRExpression();
|
||||
}
|
||||
else if (JavaTokenType.EQ.equals(assignment.getOperationTokenType())) {
|
||||
if (assignment.getRExpression() instanceof PsiBinaryExpression) {
|
||||
PsiBinaryExpression binOp = (PsiBinaryExpression)assignment.getRExpression();
|
||||
if (assignment.getRExpression() instanceof PsiBinaryExpression binOp) {
|
||||
IElementType op = TypeConversionUtil.convertEQtoOperation(compoundAssignmentOp);
|
||||
if (op.equals(binOp.getOperationTokenType())) {
|
||||
if (sameReference(binOp.getLOperand(), assignment.getLExpression())) {
|
||||
@@ -152,8 +149,7 @@ public class StreamApiMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
return var;
|
||||
}
|
||||
else if (JavaTokenType.EQ.equals(assignment.getOperationTokenType())) {
|
||||
if (assignment.getRExpression() instanceof PsiBinaryExpression) {
|
||||
PsiBinaryExpression binOp = (PsiBinaryExpression)assignment.getRExpression();
|
||||
if (assignment.getRExpression() instanceof PsiBinaryExpression binOp) {
|
||||
IElementType op = TypeConversionUtil.convertEQtoOperation(compoundAssignmentOp);
|
||||
if (op.equals(binOp.getOperationTokenType())) {
|
||||
PsiExpression left = binOp.getLOperand();
|
||||
@@ -180,11 +176,8 @@ public class StreamApiMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
return ((PsiUnaryExpression)expression).getOperand();
|
||||
}
|
||||
}
|
||||
else if (expression instanceof PsiAssignmentExpression) {
|
||||
PsiAssignmentExpression assignment = (PsiAssignmentExpression)expression;
|
||||
if (ExpressionUtils.isLiteral(extractAddend(assignment), 1)) {
|
||||
return assignment.getLExpression();
|
||||
}
|
||||
else if (expression instanceof PsiAssignmentExpression assignment && ExpressionUtils.isLiteral(extractAddend(assignment), 1)) {
|
||||
return assignment.getLExpression();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -299,13 +292,10 @@ public class StreamApiMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
static boolean isVariableSuitableForStream(PsiVariable variable, PsiStatement statement, TerminalBlock tb) {
|
||||
PsiElement block = PsiUtil.getVariableCodeBlock(variable, statement);
|
||||
if (block != null) {
|
||||
Predicate<PsiElement> notAllowedWrite = e -> {
|
||||
if (!(e instanceof PsiReferenceExpression)) return false;
|
||||
PsiReferenceExpression ref = (PsiReferenceExpression)e;
|
||||
return PsiUtil.isAccessedForWriting(ref) &&
|
||||
ref.isReferenceTo(variable) &&
|
||||
tb.operations().noneMatch(op -> op.isWriteAllowed(variable, ref));
|
||||
};
|
||||
Predicate<PsiElement> notAllowedWrite = e -> e instanceof PsiReferenceExpression ref &&
|
||||
PsiUtil.isAccessedForWriting(ref) &&
|
||||
ref.isReferenceTo(variable) &&
|
||||
tb.operations().noneMatch(op -> op.isWriteAllowed(variable, ref));
|
||||
if (PsiTreeUtil.processElements(block, notAllowedWrite.negate()::test)) return true;
|
||||
}
|
||||
return HighlightControlFlowUtil.isEffectivelyFinal(variable, statement, null);
|
||||
@@ -466,7 +456,7 @@ public class StreamApiMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
}
|
||||
FindExtremumMigration.ExtremumTerminal extremumTerminal = FindExtremumMigration.extract(tb, nonFinalVariables);
|
||||
if (extremumTerminal != null) {
|
||||
return new FindExtremumMigration(true, FindExtremumMigration.getOperation(extremumTerminal.isMax()) + "()");
|
||||
return new FindExtremumMigration(true, FindExtremumMigration.getOperation(extremumTerminal.isMax()));
|
||||
}
|
||||
for (OperationReductionMigration.ReductionOperation reductionOperation : OperationReductionMigration.OPERATIONS) {
|
||||
if (getAccumulatedVariable(tb, nonFinalVariables, reductionOperation) != null) {
|
||||
@@ -1326,8 +1316,7 @@ public class StreamApiMigrationInspection extends AbstractBaseJavaLocalInspectio
|
||||
PsiExpression updateExpr = null;
|
||||
IElementType op;
|
||||
PsiUnaryExpression unaryExpression = null;
|
||||
if (expression instanceof PsiAssignmentExpression) {
|
||||
PsiAssignmentExpression assignment = (PsiAssignmentExpression)expression;
|
||||
if (expression instanceof PsiAssignmentExpression assignment) {
|
||||
op = TypeConversionUtil.convertEQtoOperation(assignment.getOperationTokenType());
|
||||
updateExpr = assignment.getRExpression();
|
||||
if (!ExpressionUtils.isReferenceTo(assignment.getLExpression(), variable)) return null;
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.codeInspection.streamMigration;
|
||||
|
||||
import com.intellij.codeInspection.streamMigration.StreamApiMigrationInspection.MapOp;
|
||||
@@ -27,7 +13,9 @@ import static com.intellij.codeInspection.streamMigration.OperationReductionMigr
|
||||
|
||||
class SumMigration extends BaseStreamApiMigration {
|
||||
|
||||
SumMigration(boolean shouldWarn) {super(shouldWarn, "sum()");}
|
||||
SumMigration(boolean shouldWarn) {
|
||||
super(shouldWarn, "sum");
|
||||
}
|
||||
|
||||
@Override
|
||||
PsiElement migrate(@NotNull Project project, @NotNull PsiElement body, @NotNull TerminalBlock tb) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Replace with 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with count()" "true-preview"
|
||||
// "Replace with 'count()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Replace with 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Replace with 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with count()" "true-preview"
|
||||
// "Replace with 'count()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Replace with 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Replace with 'collect()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "false"
|
||||
// "Collapse loop with stream 'toArray()'" "false"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "true-preview"
|
||||
// "Collapse loop with stream 'collect()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with collect" "false"
|
||||
// "Collapse loop with stream 'collect()'" "false"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
import java.util.*;
|
||||
|
||||
public class Test {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "false"
|
||||
// "Collapse loop with stream 'toArray()'" "false"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "false"
|
||||
// "Collapse loop with stream 'toArray()'" "false"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "true-preview"
|
||||
// "Collapse loop with stream 'toArray()'" "true-preview"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with toArray" "false"
|
||||
// "Collapse loop with stream 'toArray()'" "false"
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with allMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'allMatch()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with allMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'allMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with allMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'allMatch()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with allMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'allMatch()'" "true-preview"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with allMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'allMatch()'" "true-preview"
|
||||
|
||||
public class Main {
|
||||
boolean find(String[][] data) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with allMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'allMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with allMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'allMatch()'" "true-preview"
|
||||
|
||||
public class Main {
|
||||
boolean find(String[][] data) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with allMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'allMatch()'" "true-preview"
|
||||
|
||||
public class Main {
|
||||
boolean allEmpty(String[][] data) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace with anyMatch()" "true-preview"
|
||||
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user