Answers for "check if an element is already in an array"

-2

check if an element is already in an array

private boolean ZitAlInArray(int value, List<Integer> list) {
  return array.indexOf(value) > -1;
}

private boolean zitAlInArray(int[] array, int index) {
		for (int i = 0; i < index; i++) {
			if (array[i] == array[index]) {
				return true;
			}
		} 
		return false;
	}
Posted by: Guest on November-28-2020

Code answers related to "check if an element is already in an array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language