public TrafficPattern withPhases(Phase... phases) {
        if (this.phases == null) {
            setPhases(new java.util.ArrayList<Phase>(phases.length));
        }
        for (Phase ele : phases) {
            this.phases.add(ele);
        }
        return this;
    }
<p>
Defines the phases traffic specification.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setPhases(java.util.Collection)} or {@link #withPhases(java.util.Collection)} if you want to override the
existing values.
</p>

@param phases
       Defines the phases traffic specification.
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/TrafficPattern.java