|
|
| Poem.java |
public boolean disordered() {
boolean difference = false;
for (int index = 0; !difference && index < poem.length;
++index) {
if (!poem[index].equals(shuffledPoem[index])) {
difference = true;
}
}
return difference;
}
|
![]() | Two arrays of equal length are compared component-wise.
|
![]() | They are considered equal as long no differences were found.
|
![]() | The comparison loop should immediately end as soon as the
first difference is found.
|
|
| Copyright © 2001, 2002 Andreas Borchert, converted to HTML on February 11, 2002 |