This commit is contained in:
Tim Tersch
2020-08-27 11:00:05 +02:00
parent 68f0f575b6
commit 901cce78cf

View File

@@ -212,7 +212,19 @@ public class Arrays {
* Für ein leeres Array wird <code>false<code> zurück gegeben. * Für ein leeres Array wird <code>false<code> zurück gegeben.
*/ */
public boolean xor( boolean[] pArray ) { public boolean xor( boolean[] pArray ) {
return true; if (pArray == null || pArray.length == 0) {
return false;
}
int numberOfTrue = 0;
for (boolean b : pArray) {
if (b) {
numberOfTrue++;
}
}
if (numberOfTrue == 1) {
return true;
}
return false;
} }
/** /**