public CoreNetwork withSegments(CoreNetworkSegment... segments) {
        if (this.segments == null) {
            setSegments(new java.util.ArrayList<CoreNetworkSegment>(segments.length));
        }
        for (CoreNetworkSegment ele : segments) {
            this.segments.add(ele);
        }
        return this;
    }
<p>
The segments within a core network.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setSegments(java.util.Collection)} or {@link #withSegments(java.util.Collection)} if you want to override
the existing values.
</p>

@param segments
       The segments within a core network.
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-networkmanager/src/main/java/com/amazonaws/services/networkmanager/model/CoreNetwork.java