Optimized the TreeNode constructor (#590)
This commit is contained in:
parent
f73bee24e1
commit
f2f2b48782
|
@ -1,9 +1,9 @@
|
|||
package com.baeldung.threadpool;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
public class TreeNode {
|
||||
|
||||
int value;
|
||||
|
@ -12,8 +12,7 @@ public class TreeNode {
|
|||
|
||||
public TreeNode(int value, TreeNode... children) {
|
||||
this.value = value;
|
||||
this.children = new HashSet<>();
|
||||
this.children.addAll(Arrays.asList(children));
|
||||
this.children = Sets.newHashSet(children);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue