summaryrefslogtreecommitdiffstats
path: root/config-lib
diff options
context:
space:
mode:
authorgjoranv <gv@yahoo-inc.com>2017-07-19 12:21:30 +0200
committergjoranv <gv@yahoo-inc.com>2017-07-19 12:24:05 +0200
commit07062cb52dd1c9e9a43f8d4348f246bb58cc1110 (patch)
tree624087c5f23d9ca2fd3d0b6a64008e13f92607b2 /config-lib
parent08cb10529409f97a8b2ff56e7d398436419c53fa (diff)
Declare helper methods static.
+ bugfix: iterate over given list, not field 'vector'
Diffstat (limited to 'config-lib')
-rw-r--r--config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java18
1 files changed, 9 insertions, 9 deletions
diff --git a/config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java b/config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java
index a5dee11637f..d1d5fc61915 100644
--- a/config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java
+++ b/config-lib/src/main/java/com/yahoo/config/LeafNodeVector.java
@@ -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) {