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

View File

@@ -212,8 +212,20 @@ public class Arrays {
* Für ein leeres Array wird <code>false<code> zurück gegeben.
*/
public boolean xor( boolean[] pArray ) {
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;
}
/**
* Erzeugt aus einem String-Array einen neuen String,