mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[multiple] Cleanup: use LinkedHashSet.getFirst()
GitOrigin-RevId: ac2d373834829e3a33528afbeacee8037a935ead
This commit is contained in:
committed by
intellij-monorepo-bot
parent
25d94d0bf4
commit
2c605ea01d
+1
-1
@@ -157,7 +157,7 @@ public class PullAsAbstractUpFix extends LocalQuickFixAndIntentionActionOnPsiEle
|
||||
name = JavaBundle.message("intention.name.extract.method.to.new.interface", methodWithOverrides.getName());
|
||||
canBePulledUp = false;
|
||||
} else if (classesToPullUp.size() == 1) {
|
||||
final PsiClass baseClass = classesToPullUp.iterator().next();
|
||||
final PsiClass baseClass = classesToPullUp.getFirst();
|
||||
name = JavaBundle.message("intention.name.pull.method.up.and.make.it.abstract.conditionally", methodWithOverrides.getName(), baseClass.getName(), !baseClass.hasModifierProperty(PsiModifier.ABSTRACT) ? 0 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class TypeExpression extends Expression {
|
||||
}
|
||||
if (myItems.isEmpty()) return null;
|
||||
|
||||
final PsiType type = myItems.iterator().next().getType();
|
||||
final PsiType type = myItems.getFirst().getType();
|
||||
return type == null ? null : new PsiTypeResult(type, project) {
|
||||
@Override
|
||||
public void handleRecalc(PsiFile psiFile, Document document, int segmentStart, int segmentEnd) {
|
||||
|
||||
@@ -497,7 +497,7 @@ public final class PushLog extends JPanel implements Disposable, UiDataProvider
|
||||
.toCollection(LinkedHashSet::new);
|
||||
if (checkedNodes.isEmpty()) return;
|
||||
// use new state from first lead node;
|
||||
boolean newState = !checkedNodes.iterator().next().isChecked();
|
||||
boolean newState = !checkedNodes.getFirst().isChecked();
|
||||
checkedNodes.forEach(n -> myTree.setNodeState(n, newState));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ public final class RunInspectionIntention implements IntentionAction, HighPriori
|
||||
LinkedHashSet<InspectionToolWrapper<?, ?>> allWrappers = new LinkedHashSet<>();
|
||||
allWrappers.add(toolWrapper);
|
||||
rootProfile.collectDependentInspections(toolWrapper, allWrappers, project);
|
||||
List<InspectionToolWrapper<?, ?>> toolWrappers = allWrappers.size() == 1 ? Collections.singletonList(allWrappers.iterator().next()) : new ArrayList<>(allWrappers);
|
||||
List<InspectionToolWrapper<?, ?>> toolWrappers = allWrappers.size() == 1 ? Collections.singletonList(allWrappers.getFirst()) : new ArrayList<>(allWrappers);
|
||||
InspectionProfileImpl model = new InspectionProfileImpl(toolWrapper.getDisplayName(), new InspectionToolsSupplier.Simple(toolWrappers), rootProfile);
|
||||
for (InspectionToolWrapper wrapper : toolWrappers) {
|
||||
model.enableTool(wrapper.getShortName(), project);
|
||||
|
||||
+1
-1
@@ -300,7 +300,7 @@ public abstract class AttachToProcessActionBase extends AnAction implements Dumb
|
||||
hostRecentItems.add(newRecentItem);
|
||||
|
||||
while (hostRecentItems.size() > 4) {
|
||||
hostRecentItems.remove(hostRecentItems.iterator().next());
|
||||
hostRecentItems.remove(hostRecentItems.getFirst());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -137,10 +137,10 @@ public abstract class UpdatePsiFileCopyright extends AbstractUpdateCopyright {
|
||||
}
|
||||
|
||||
if (commentHere && found.size() == 1) {
|
||||
CommentRange range = found.iterator().next();
|
||||
CommentRange range = found.getFirst();
|
||||
// Is the comment in the right place?
|
||||
if (langOpts.isRelativeBefore() && range.getFirst() == comments.get(0) ||
|
||||
!langOpts.isRelativeBefore() && range.getLast() == comments.get(comments.size() - 1)) {
|
||||
if (langOpts.isRelativeBefore() && range.getFirst() == comments.getFirst() ||
|
||||
!langOpts.isRelativeBefore() && range.getLast() == comments.getLast()) {
|
||||
// Check to see if current copyright comment matches new one.
|
||||
String newComment = getCommentText("", "");
|
||||
resetCommentText();
|
||||
|
||||
@@ -838,7 +838,7 @@ public class JUnitConfiguration extends JavaTestConfigurationWithDiscoverySuppor
|
||||
if (TEST_PATTERN.equals(TEST_OBJECT)) {
|
||||
final int size = myPattern.size();
|
||||
if (size == 0) return JUnitBundle.message("default.junit.config.name.temp.suite");
|
||||
String fqName = myPattern.iterator().next();
|
||||
String fqName = myPattern.getFirst();
|
||||
String firstName =
|
||||
fqName.contains("*") ? fqName
|
||||
: StringUtil.getShortName(fqName.contains("(") ? StringUtil.getPackageName(fqName, '(') : fqName);
|
||||
|
||||
Reference in New Issue
Block a user