mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
add indexOf and lastIndexOf methods to java.util.List
This commit is contained in:
@ -73,6 +73,24 @@ public class Arrays {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int indexOf(Object element) {
|
||||
for (int i = 0; i < array.length; ++i) {
|
||||
if (equal(element, array[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int lastIndexOf(Object element) {
|
||||
for (int i = array.length - 1; i >= 0; --i) {
|
||||
if (equal(element, array[i])) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public T get(int index) {
|
||||
return array[index];
|
||||
}
|
||||
|
Reference in New Issue
Block a user