forked from IF-LK-2020/array
or() finished
This commit is contained in:
@@ -197,8 +197,16 @@ 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 or( boolean[] pArray ) {
|
public boolean or( boolean[] pArray ) {
|
||||||
|
if( pArray.length == 0 ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for(int i=0;i<pArray.length;i++){
|
||||||
|
if(pArray[i]== true){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prüft, ob <b>genau ein</b> Element in einem Array von
|
* Prüft, ob <b>genau ein</b> Element in einem Array von
|
||||||
|
|||||||
Reference in New Issue
Block a user