Declare helper methods static.
+ bugfix: iterate over given list, not field 'vector'
@@ -34,27 +34,27 @@ public class LeafNodeVector<REAL, NODE extends LeafNode<REAL>> extends NodeVecto
realValues = realList(vector);
}
+ @SuppressWarnings("unchecked")
+ public List<REAL> asList() {
+ return realValues;
+ }
+
/**
* Creates a new Node by cloning the default node.
*/
@SuppressWarnings("unchecked")
- private NODE createNew(NODE defaultNode) {
+ private static <NODE extends LeafNode<?>> NODE createNew(NODE defaultNode) {
return (NODE) (defaultNode).clone();
}
- private List<REAL> realList(List<NODE> nodes) {
- List<REAL> reals = new ArrayList<REAL>();
- for(NODE node : vector) {
+ private static<REAL, NODE extends LeafNode<REAL>> List<REAL> realList(List<NODE> nodes) {
+ List<REAL> reals = new ArrayList<>();
+ for(NODE node : nodes) {
reals.add(node.value());
}
return Collections.unmodifiableList(reals);
}
- @SuppressWarnings("unchecked")
- public List<REAL> asList() {
- return realValues;
- }
-
// TODO: Try to eliminate the need for this method when we have moved FileAcquirer to the config library
// It is needed now because the builder has a list of String, while REAL=FileReference.
public static LeafNodeVector<FileReference, FileNode> createFileNodeVector(Collection<String> values) {
