List of utility methods to do Array Last Index Of
int | lastIndexOf(Object[] array, Object object) last Index Of if (object != null) { for (int i = array.length - 1; i >= 0; i--) { if (object.equals(array[i])) { return i; return -1; for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; return -1; |
int | lastIndexOf(Object[] array, Object objectToFind) last Index Of return lastIndexOf(array, objectToFind, Integer.MAX_VALUE);
|
int | lastIndexOf(Object[] elements, Object value) Returns the index of the last occurrence of the specified element in this array, or -1 if this list does not contain the element. for (int i = elements.length - 1; i >= 0; --i) { if (equals(elements[i], value)) { return i; return -1; |
int | lastIndexOf(String source, char[] chars) Returns the last index of any of the given chars in the given source. If no char is found, -1 is returned.
int result = -1; for (int i = 0; i < chars.length; i++) { int pos = source.lastIndexOf(chars[i]); if (pos > result) { result = pos; return result; ... |
int | lastIndexOf(String str, String[] path) last Index Of for (int i = path.length; 0 < i; i--) { if (path[i - 1].compareTo(str) == 0) { return i - 1; return -1; |
int | lastIndexOf(T[] array, T valueToFind, int startIndex) last Index Of if (array == null) return -1; if (startIndex < 0) return -1; if (startIndex >= array.length) startIndex = array.length - 1; for (int i = startIndex; i >= 0; i--) if (valueToFind.equals(array[i])) ... |
int | lastIndexOfAny(byte[] values, byte[] array) last Index Of Any if (array == null) throw new IllegalArgumentException("array cannot be null"); return lastIndexOfAny(values, array, 0, array.length); |
int | LastIndexOfAny(String str, char[] search) Last Index Of Any int i = -1; for (char s : search) { i = Math.max(str.indexOf(s), i); return i; |
int | lastIndexOfAny(String str, char[] searchChars, int startPos) last Index Of Any if ((str == null) || (searchChars == null)) { return -1; if (startPos < 0) { startPos = 0; for (int i = str.length() - 1; i >= startPos; i--) { char c = str.charAt(i); ... |
int | lastIndexOfAny(String str, char[] targets) last Index Of Any int result = -1; for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); for (char target : targets) { if (ch == target) { result = i; break; return result; |