mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
putIfAbsent & computeIfAbsent used; cosmetic fixes
This commit is contained in:
+1
-3
@@ -123,9 +123,7 @@ public class SystemBuilder {
|
||||
Boolean good = myMethodCache.get(method);
|
||||
|
||||
if (good != null && good.booleanValue()) {
|
||||
if (myMethods.get(method) == null) {
|
||||
myMethods.put(method, method);
|
||||
}
|
||||
myMethods.putIfAbsent(method, method);
|
||||
|
||||
if (parameter != null && myParameters.get(parameter) == null) {
|
||||
myParameters.put(parameter, parameter);
|
||||
|
||||
+6
-10
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -55,7 +55,7 @@ public class KeyStrokeMap {
|
||||
|
||||
String symbol = null;
|
||||
int beforeSymbol = -1;
|
||||
boolean haveSymbol = false;
|
||||
boolean haveSymbol;
|
||||
KeyStroke symbolStroke = null;
|
||||
|
||||
if (hasModifiers) {
|
||||
@@ -102,7 +102,7 @@ public class KeyStrokeMap {
|
||||
return KeyStroke.getKeyStroke(symbolStroke.getKeyCode(), modifiers, false);
|
||||
}
|
||||
|
||||
private KeyStroke throwUnrecognized(String symbol) {
|
||||
private static KeyStroke throwUnrecognized(String symbol) {
|
||||
throw new IllegalArgumentException("Unrecoginzed symbol: " + symbol);
|
||||
}
|
||||
|
||||
@@ -136,8 +136,7 @@ public class KeyStrokeMap {
|
||||
{'\'', KeyEvent.VK_QUOTE, 0,}, {'"', KeyEvent.VK_QUOTE, shift,},};
|
||||
HashMap<Character, KeyStroke> map = new HashMap<>();
|
||||
// Universal mappings
|
||||
for (int i = 0; i < universalMappings.length; i++) {
|
||||
int[] entry = universalMappings[i];
|
||||
for (int[] entry : universalMappings) {
|
||||
KeyStroke stroke = KeyStroke.getKeyStroke(entry[1], entry[2]);
|
||||
map.put(new Character((char)entry[0]), stroke);
|
||||
}
|
||||
@@ -151,8 +150,7 @@ public class KeyStrokeMap {
|
||||
//}
|
||||
|
||||
// Basic symbol/punctuation mappings
|
||||
for (int i = 0; i < mappings.length; i++) {
|
||||
int[] entry = mappings[i];
|
||||
for (int[] entry : mappings) {
|
||||
KeyStroke stroke = KeyStroke.getKeyStroke(entry[1], entry[2]);
|
||||
map.put(new Character((char)entry[0]), stroke);
|
||||
}
|
||||
@@ -164,9 +162,7 @@ public class KeyStrokeMap {
|
||||
stroke = KeyStroke.getKeyStroke(KeyEvent.VK_A + i - 'a', ctrl);
|
||||
Character key = new Character((char)(i - 'a' + 1));
|
||||
// Make sure we don't overwrite something already there
|
||||
if (map.get(key) == null) {
|
||||
map.put(key, stroke);
|
||||
}
|
||||
map.putIfAbsent(key, stroke);
|
||||
}
|
||||
// Capitals
|
||||
for (int i = 'A'; i <= 'Z'; i++) {
|
||||
|
||||
+16
-3
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.
|
||||
*/
|
||||
package com.intellij.structuralsearch.plugin.replace.impl;
|
||||
|
||||
import com.intellij.codeInsight.template.Template;
|
||||
@@ -127,9 +142,7 @@ public final class ReplacementBuilder {
|
||||
|
||||
private static void fill(MatchResult r,Map<String,MatchResult> m) {
|
||||
if (r.getName()!=null) {
|
||||
if (m.get(r.getName()) == null) {
|
||||
m.put(r.getName(), r);
|
||||
}
|
||||
m.putIfAbsent(r.getName(), r);
|
||||
}
|
||||
|
||||
if (!r.isScopeMatch() || !r.isMultipleMatch()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -55,10 +55,7 @@ public class GitCheckAttrParser {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (myAttributes.get(file) == null) {
|
||||
myAttributes.put(file, new ArrayList<>());
|
||||
}
|
||||
myAttributes.get(file).add(attr);
|
||||
myAttributes.computeIfAbsent(file, f -> new ArrayList<>()).add(attr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -309,8 +309,7 @@ public class TestNGUtil {
|
||||
annotation = AnnotationUtil.findAnnotation(method, test);
|
||||
if (annotation != null) {
|
||||
if (isAnnotatedWithParameter(annotation, parameter, values)) {
|
||||
if (results.get(psiClass) == null) results.put(psiClass, new LinkedHashSet<>());
|
||||
results.get(psiClass).add(method);
|
||||
results.computeIfAbsent(psiClass, c -> new LinkedHashSet<>()).add(method);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -55,7 +55,7 @@ public class DomElementsToggleAction extends ToggleAction {
|
||||
if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(AbstractDomElementNode.TREE_NODES_HIDERS_KEY,
|
||||
new HashMap<>());
|
||||
|
||||
if(getHiders().get(myClass) == null) getHiders().put(myClass, true);
|
||||
getHiders().putIfAbsent(myClass, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user