HostInterface; support immutable datamodel in builder
@@ -4,7 +4,9 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Iterables;
import java.io.Serializable;
+import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import org.batfish.common.Warnings;
@@ -135,8 +137,7 @@ public class HostInterface implements Serializable {
Interface iface = new Interface(_canonicalName, configuration);
iface.setBandwidth(_bandwidth);
iface.setPrefix(_prefix);
- iface.getAllPrefixes().add(_prefix);
- iface.getAllPrefixes().addAll(_otherPrefixes);
+ iface.setAllPrefixes(Iterables.concat(Collections.singleton(_prefix), _otherPrefixes));
iface.setVrf(configuration.getDefaultVrf());
if (_shared) {
SourceNat sourceNat = new SourceNat();
