Browse Source

Inefficient Usages of Java Collections (#6187)

2.0.7-release
DittoTool 3 years ago committed by GitHub
parent
commit
a245e141d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/aspect/AccessLogAspect.java
  2. 6
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/gantt/Task.java
  3. 6
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParam.java
  4. 6
      dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParam.java

5
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/aspect/AccessLogAspect.java

@ -24,6 +24,7 @@ import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
@ -99,11 +100,11 @@ public class AccessLogAspect {
if (annotation.ignoreRequestArgs().length > 0) {
String[] parameterNames = ((MethodSignature) proceedingJoinPoint.getSignature()).getParameterNames();
if (parameterNames.length > 0) {
List<String> ignoreList = Arrays.stream(annotation.ignoreRequestArgs()).collect(Collectors.toList());
Set<String> ignoreSet = Arrays.stream(annotation.ignoreRequestArgs()).collect(Collectors.toSet());
HashMap<String, Object> argsMap = new HashMap<>();
for (int i = 0; i < parameterNames.length; i++) {
if (!ignoreList.contains(parameterNames[i])) {
if (!ignoreSet.contains(parameterNames[i])) {
argsMap.put(parameterNames[i], args[i]);
}
}

6
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/gantt/Task.java

@ -18,8 +18,8 @@ package org.apache.dolphinscheduler.api.dto.gantt;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
/**
@ -34,11 +34,11 @@ public class Task {
/**
* task start date
*/
private List<Long> startDate = new ArrayList<>();
private List<Long> startDate = new LinkedList<>();
/**
* task end date
*/
private List<Long> endDate = new ArrayList<>();
private List<Long> endDate = new LinkedList<>();
/**
* task execution date

6
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/radio/RadioParam.java

@ -24,7 +24,7 @@ import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
@ -65,7 +65,7 @@ public class RadioParam extends PluginParams {
public Builder addParamsOptions(ParamsOptions paramsOptions) {
if (this.options == null) {
this.options = new ArrayList<>();
this.options = new LinkedList<>();
}
this.options.add(paramsOptions);
@ -104,7 +104,7 @@ public class RadioParam extends PluginParams {
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
this.validateList = new LinkedList<>();
}
this.validateList.add(validate);
return this;

6
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/params/select/SelectParam.java

@ -23,7 +23,7 @@ import org.apache.dolphinscheduler.spi.params.base.ParamsOptions;
import org.apache.dolphinscheduler.spi.params.base.PluginParams;
import org.apache.dolphinscheduler.spi.params.base.Validate;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
/**
@ -60,7 +60,7 @@ public class SelectParam extends PluginParams {
public Builder addOptions(ParamsOptions paramsOptions) {
if (this.options == null) {
this.options = new ArrayList<>();
this.options = new LinkedList<>();
}
this.options.add(paramsOptions);
@ -99,7 +99,7 @@ public class SelectParam extends PluginParams {
public Builder addValidate(Validate validate) {
if (this.validateList == null) {
this.validateList = new ArrayList<>();
this.validateList = new LinkedList<>();
}
this.validateList.add(validate);
return this;

Loading…
Cancel
Save