Skip to content

Commit

Permalink
Parameterized constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Feb 21, 2019
1 parent c5b9606 commit 9299974
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 20 deletions.
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/cli/ConnectNodeCommand.java
Expand Up @@ -62,8 +62,7 @@ protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getActiveInstance();

final HashSet<String> hs = new HashSet<>();
hs.addAll(nodes);
final HashSet<String> hs = new HashSet<>(nodes);

List<String> names = null;

Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/cli/DeleteJobCommand.java
Expand Up @@ -55,8 +55,7 @@ protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getActiveInstance();

final HashSet<String> hs = new HashSet<>();
hs.addAll(jobs);
final HashSet<String> hs = new HashSet<>(jobs);

for (String job_s: hs) {
AbstractItem job = null;
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/cli/DeleteNodeCommand.java
Expand Up @@ -55,8 +55,7 @@ protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getActiveInstance();

final HashSet<String> hs = new HashSet<>();
hs.addAll(nodes);
final HashSet<String> hs = new HashSet<>(nodes);

for (String node_s : hs) {
Node node = null;
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/cli/DeleteViewCommand.java
Expand Up @@ -56,8 +56,7 @@ protected int run() throws Exception {
boolean errorOccurred = false;

// Remove duplicates
final HashSet<String> hs = new HashSet<>();
hs.addAll(views);
final HashSet<String> hs = new HashSet<>(views);

ViewOptionHandler voh = new ViewOptionHandler(null, null, null);

Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/cli/DisconnectNodeCommand.java
Expand Up @@ -61,8 +61,7 @@ protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getActiveInstance();

final HashSet<String> hs = new HashSet<>();
hs.addAll(nodes);
final HashSet<String> hs = new HashSet<>(nodes);

List<String> names = null;

Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/cli/ReloadJobCommand.java
Expand Up @@ -62,8 +62,7 @@ protected int run() throws Exception {
boolean errorOccurred = false;
final Jenkins jenkins = Jenkins.getActiveInstance();

final HashSet<String> hs = new HashSet<>();
hs.addAll(jobs);
final HashSet<String> hs = new HashSet<>(jobs);

for (String job_s: hs) {
AbstractItem job = null;
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/model/Computer.java
Expand Up @@ -259,8 +259,7 @@ public List<ComputerPanelBox> getComputerPanelBoxs(){
*/
@SuppressWarnings("deprecation")
public List<Action> getActions() {
List<Action> result = new ArrayList<>();
result.addAll(super.getActions());
List<Action> result = new ArrayList<>(super.getActions());
synchronized (this) {
if (transientActions == null) {
transientActions = TransientComputerActionFactory.createAllFor(this);
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/model/Fingerprint.java
Expand Up @@ -967,8 +967,7 @@ public RangeSet getRangeSet(Job job) {
* Gets the sorted list of job names where this jar is used.
*/
public @Nonnull List<String> getJobs() {
List<String> r = new ArrayList<>();
r.addAll(usages.keySet());
List<String> r = new ArrayList<>(usages.keySet());
Collections.sort(r);
return r;
}
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/model/View.java
Expand Up @@ -754,8 +754,7 @@ else if (info.getLastChange().before(r.getTimestamp())) {
}

private List<UserInfo> toList(Map<User,UserInfo> users) {
ArrayList<UserInfo> list = new ArrayList<>();
list.addAll(users.values());
ArrayList<UserInfo> list = new ArrayList<>(users.values());
Collections.sort(list);
return Collections.unmodifiableList(list);
}
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/hudson/tasks/Shell.java
Expand Up @@ -88,8 +88,7 @@ public String[] buildCommandLine(FilePath script) {
// interpreter override
int end = command.indexOf('\n');
if(end<0) end=command.length();
List<String> args = new ArrayList<>();
args.addAll(Arrays.asList(Util.tokenize(command.substring(0,end).trim())));
List<String> args = new ArrayList<>(Arrays.asList(Util.tokenize(command.substring(0, end).trim())));
args.add(script.getRemote());
args.set(0,args.get(0).substring(2)); // trim off "#!"
return args.toArray(new String[0]);
Expand Down

0 comments on commit 9299974

Please sign in to comment.