mirror of
https://github.com/corda/corda.git
synced 2025-01-24 05:18:24 +00:00
implement AbstractList.indexOf
This commit is contained in:
parent
4026ad208c
commit
21cc4c6a87
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (c) 2009, Avian Contributors
|
/* Copyright (c) 2009-2011, Avian Contributors
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software
|
Permission to use, copy, modify, and/or distribute this software
|
||||||
for any purpose with or without fee is hereby granted, provided
|
for any purpose with or without fee is hereby granted, provided
|
||||||
@ -22,4 +22,20 @@ public abstract class AbstractList<T> extends AbstractCollection<T>
|
|||||||
public ListIterator<T> listIterator() {
|
public ListIterator<T> listIterator() {
|
||||||
return new Collections.ArrayListIterator(this);
|
return new Collections.ArrayListIterator(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int indexOf(Object o) {
|
||||||
|
int i = 0;
|
||||||
|
for (T v: this) {
|
||||||
|
if (o == null) {
|
||||||
|
if (v == null) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
} else if (o.equals(v)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
++ i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user