public RegisterTaskDefinitionRequest withVolumes(Volume... volumes) {
        if (this.volumes == null) {
            setVolumes(new com.amazonaws.internal.SdkInternalList<Volume>(volumes.length));
        }
        for (Volume ele : volumes) {
            this.volumes.add(ele);
        }
        return this;
    }
<p>
A list of volume definitions in JSON format that containers in your task might use.
</p>
<p>
<b>NOTE:</b> This method appends the values to the existing list (if any). Use
{@link #setVolumes(java.util.Collection)} or {@link #withVolumes(java.util.Collection)} if you want to override
the existing values.
</p>

@param volumes
       A list of volume definitions in JSON format that containers in your task might use.
@return Returns a reference to this object so that method calls can be chained together.
aws-java-sdk-ecs/src/main/java/com/amazonaws/services/ecs/model/RegisterTaskDefinitionRequest.java