vendredi 30 décembre 2016

Java poll() inside if statement

I had a little question over the execution of functions inside of an if statement.
For example this list of edges(integers), will all the values be removed from the list until it pull's 5 from the list? Or what will happen exactly.

LinkedList<Integer> edges = new LinkedList<>();

for (int i = 0; i < edges.size(); i++) {
        if(edges.poll() == 5){
            break;
        }
}

Aucun commentaire:

Enregistrer un commentaire