本文整理了Java中java.util.ArrayList.lastIndexOf()
方法的一些代码示例,展示了ArrayList.lastIndexOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayList.lastIndexOf()
方法的具体详情如下:
包路径:java.util.ArrayList
类名称:ArrayList
方法名:lastIndexOf
[英]Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the highest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.
[中]返回此列表中指定元素最后一次出现的索引,如果此列表不包含该元素,则返回-1。更正式地说,返回最高的索引i,这样(o==null?get(i)==null:o.equals(get(i)),或者如果没有这样的索引,则返回-1。
代码示例来源:origin: ReactiveX/RxJava
@Override
public int lastIndexOf(Object o) {
return list.lastIndexOf(o);
}
代码示例来源:origin: redisson/redisson
@Override
public int lastIndexOf(Object o) {
return list.lastIndexOf(o);
}
代码示例来源:origin: commons-collections/commons-collections
/**
* Search for the last occurrence of the given argument, testing
* for equality using the <code>equals()</code> method, and return
* the corresponding index, or -1 if the object is not found.
*
* @param element The element to search for
*/
public int lastIndexOf(Object element) {
if (fast) {
return (list.lastIndexOf(element));
} else {
synchronized (list) {
return (list.lastIndexOf(element));
}
}
}
代码示例来源:origin: ltsopensource/light-task-scheduler
public int lastIndexOf(Object o) {
return list.lastIndexOf(o);
}
代码示例来源:origin: ltsopensource/light-task-scheduler
public int lastIndexOf(Object o) {
return list.lastIndexOf(o);
}
代码示例来源:origin: wildfly/wildfly
/**
* Search for the last occurrence of the given argument, testing
* for equality using the <code>equals()</code> method, and return
* the corresponding index, or -1 if the object is not found.
*
* @param element The element to search for
*/
public int lastIndexOf(Object element) {
if (fast) {
return (list.lastIndexOf(element));
} else {
synchronized (list) {
return (list.lastIndexOf(element));
}
}
}
代码示例来源:origin: spotbugs/spotbugs
public void test3NoBugs(ArrayList<? extends CharSequence> list) {
list.lastIndexOf(new StringBuffer("Key"));
}
代码示例来源:origin: spotbugs/spotbugs
public void test3Bugs(ArrayList<? extends CharSequence> list) {
list.lastIndexOf(Integer.valueOf(3));
}
代码示例来源:origin: org.jsoup/jsoup
void insertOnStackAfter(Element after, Element in) {
int i = stack.lastIndexOf(after);
Validate.isTrue(i != -1);
stack.add(i+1, in);
}
代码示例来源:origin: org.jsoup/jsoup
private void replaceInQueue(ArrayList<Element> queue, Element out, Element in) {
int i = queue.lastIndexOf(out);
Validate.isTrue(i != -1);
queue.set(i, in);
}
代码示例来源:origin: rubenlagus/TelegramBots
public int lastIndexOf(String text) {
return super.lastIndexOf(new KeyboardButton(text));
}
代码示例来源:origin: cmusphinx/sphinx4
/**
* Calculates the coaccessible states of an fst
*/
private static void calcCoAccessible(Fst fst, State state,
ArrayList<ArrayList<State>> paths, HashSet<State> coaccessible) {
// hold the coaccessible added in this loop
ArrayList<State> newCoAccessibles = new ArrayList<State>();
for (ArrayList<State> path : paths) {
int index = path.lastIndexOf(state);
if (index != -1) {
if (state.getFinalWeight() != fst.getSemiring().zero()
|| coaccessible.contains(state)) {
for (int j = index; j > -1; j--) {
if (!coaccessible.contains(path.get(j))) {
newCoAccessibles.add(path.get(j));
coaccessible.add(path.get(j));
}
}
}
}
}
// run again for the new coaccessibles
for (State s : newCoAccessibles) {
calcCoAccessible(fst, s, paths, coaccessible);
}
}
代码示例来源:origin: geotools/geotools
/**
* Returns the index of the last occurrence of the specified element in this list, or -1 if
* none.
*/
@Override
public int lastIndexOf(Object o) {
synchronized (getLock()) {
return super.lastIndexOf(o);
}
}
代码示例来源:origin: biojava/biojava
/**
*
* @param compound
* @return
*/
@Override
public int getLastIndexOf(C compound) {
return this.parsedCompounds.lastIndexOf(compound) + 1;
}
代码示例来源:origin: graphstream/gs-core
/**
* Remove a style change listener.
*
* @param listener
* The listener to remove.
*/
public void removeListener(StyleGroupListener listener) {
int index = listeners.lastIndexOf(listener);
if (index >= 0) {
listeners.remove(index);
}
}
代码示例来源:origin: org.graphstream/gs-core
/**
* Remove an event from the set.
*
* @param event
* The event to remove.
*/
public void popEvent(String event) {
int index = eventSet.lastIndexOf(event);
if (index >= 0)
eventSet.remove(index);
events = eventSet.toArray(events);
}
代码示例来源:origin: io.snappydata/gemfirexd
void remove(Context context) {
if (context == top_) {
pop();
return;
}
stack_.remove(stack_.lastIndexOf(context));
}
Context top() {
代码示例来源:origin: com.vaadin.external.jsoup/jsoup-case-sensitive
void insertOnStackAfter(Element after, Element in) {
int i = stack.lastIndexOf(after);
Validate.isTrue(i != -1);
stack.add(i+1, in);
}
代码示例来源:origin: itext/itext7
private void replaceInQueue(ArrayList<Element> queue, Element out, Element in) {
int i = queue.lastIndexOf(out);
Validate.isTrue(i != -1);
queue.set(i, in);
}
代码示例来源:origin: org.compass-project/compass
public int lastIndexOf(Object o) {
if (fullyLoaded) {
return objectList.lastIndexOf(o);
}
return super.lastIndexOf(o);
}
内容来源于网络,如有侵权,请联系作者删除!