Hallo wie finde ich am besten/schnellsten heraus, ob ein Array 2 bestimmte Strings enthält? Ich habe das so gemacht:
Gibt es in JAVA z.B. eine find(String1, String2)-Methode die man auf's Array anwenden kann?
Java:
boolean status = false;
for (int i = 0; a.length; i++) {
if ( a[i].equals("String1") )
status = true;
if ( status && a[i].equals("String2") )
System.out.println("Beide Strings im Array enthalten")
}
Gibt es in JAVA z.B. eine find(String1, String2)-Methode die man auf's Array anwenden kann?