Created
June 11, 2016 23:24
-
-
Save TwiN/f7c93f21ac926b58620d4a153f4355fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static boolean isInList(String[] myList, String element) { | |
for(String s: myList) { | |
if (s.equals(element)) { return true; } | |
} | |
return false; | |
} | |
public static boolean isInList(char[] myList, char element) { | |
for(char c: myList) { | |
if (c == element) { return true; } | |
} | |
return false; | |
} | |
public static boolean isInList(int[] myList, int element) { | |
for(int i: myList) { | |
if (i == element) { return true; } | |
} | |
return false; | |
} | |
public static boolean isInList(float[] myList, float element) { | |
for(float i: myList) { | |
if (i == element) { return true; } | |
} | |
return false; | |
} | |
public static boolean isInList(double[] myList, double element) { | |
for(double i: myList) { | |
if (i == element) { return true; } | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment