use Collections.addAll rather manually copying array

This commit is contained in:
javanna 2016-09-06 16:15:07 +02:00 committed by Luca Cavanna
parent 1ff22fe32a
commit a33e4b1d76
1 changed files with 2 additions and 3 deletions

View File

@ -24,6 +24,7 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
public class CommonStatsFlags implements Writeable, Cloneable { public class CommonStatsFlags implements Writeable, Cloneable {
@ -44,9 +45,7 @@ public class CommonStatsFlags implements Writeable, Cloneable {
public CommonStatsFlags(Flag... flags) { public CommonStatsFlags(Flag... flags) {
if (flags.length > 0) { if (flags.length > 0) {
clear(); clear();
for (Flag f : flags) { Collections.addAll(this.flags, flags);
this.flags.add(f);
}
} }
} }