Set atriibutes from current element of and ArrayList on the next element of an ArrayList
<p>I have 3 classes: Neuron,Layer, Network.</p>

<p>A Layer contains a collection of Neurons and a Network contains a collection of Layers.</p>

<p>A neuron has(attributes) a collection of inputs(Double) and only one output(Double).</p>

<p>Inside the network class I have:</p>

<pre><code>private ArrayList&lt;Layer&gt; layers;
</code></pre>

<p>I would like to cycle through every layer in layers and through every neuron in the neurons of the current layer and set their individual output as inputs of every neuron of the next layer until I have gone through all the layers.</p>

<p>Now I have the following method which tries to accomplish this:</p>

<pre><code>public void execute(){

    //Connecting Network
    for (Layer l : layers){
        int counter = 0;
        while (counter &lt; layers.size()){

            for (Neuron n: l.neurons ){
                neuronOfNextLayer.addInputs(neuronOfPreviousLyaer.output);
            }
            counter++;
        }
    }


}
</code></pre>

<p>Now how would I replace the</p>

<pre><code>neuronOfNextLayer.addInputs(neuronOfPreviousLyaer.output);
</code></pre>

<p>part of the loop for something that actually goes through the ouputs of every layer in layers and sets the as inputs of every neuron of the next layer?</p>
