本文整理了Java中java.util.LinkedList.lastIndexOf()
方法的一些代码示例,展示了LinkedList.lastIndexOf()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.lastIndexOf()
方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名: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: hankcs/HanLP
@Override
public int lastIndexOf(Object o)
{
return pipeList.lastIndexOf(o);
}
代码示例来源:origin: spotbugs/spotbugs
public void test4NoBugs(LinkedList<? super CharSequence> list) {
list.lastIndexOf(new StringBuffer("Key"));
}
代码示例来源:origin: spotbugs/spotbugs
public void test4Bugs(LinkedList<? super CharSequence> list) {
list.lastIndexOf(Integer.valueOf(3));
}
代码示例来源:origin: org.codehaus.plexus/plexus-utils
/**
* This method will be called when an edge leading to given vertex was added and we want to check if introduction of
* this edge has not resulted in apparition of cycle in the graph
*
* @param vertex
* @param vertexStateMap
* @return
*/
public static List<String> introducesCycle( final Vertex vertex, final Map<Vertex, Integer> vertexStateMap )
{
final LinkedList<String> cycleStack = new LinkedList<String>();
final boolean hasCycle = dfsVisit( vertex, cycleStack, vertexStateMap );
if ( hasCycle )
{
// we have a situation like: [b, a, c, d, b, f, g, h].
// Label of Vertex which introduced the cycle is at the first position in the list
// We have to find second occurrence of this label and use its position in the list
// for getting the sublist of vertex labels of cycle participants
//
// So in our case we are searching for [b, a, c, d, b]
final String label = cycleStack.getFirst();
final int pos = cycleStack.lastIndexOf( label );
final List<String> cycle = cycleStack.subList( 0, pos + 1 );
Collections.reverse( cycle );
return cycle;
}
return null;
}
代码示例来源:origin: neo4j/neo4j
waitingThreadList.lastIndexOf( lockRequest ) );
代码示例来源:origin: apache/ignite
if (sync.waitingThreads.contains(thread.getId())) {
val.setChanged(nodes.lastIndexOf(thisNode) == 0);
代码示例来源:origin: it.unibo.alice.tuprolog/tuprolog
@Override
public int lastIndexOf(Object o) {
return list.lastIndexOf(o);
}
代码示例来源:origin: com.hankcs/hanlp
@Override
public int lastIndexOf(Object o)
{
return pipeList.lastIndexOf(o);
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/**
* @see List#lastIndexOf(Object)
*/
@Override
public int lastIndexOf(Object o) {
return this.processors.lastIndexOf(o);
}
代码示例来源:origin: shizuchengxuyuan/net.sz.java
@Override
public int lastIndexOf(Object o) {
synchronized (this) {
return super.lastIndexOf(o); //To change body of generated methods, choose Tools | Templates.
}
}
代码示例来源:origin: harbby/presto-connectors
/**
* @see List#lastIndexOf(Object)
*/
@Override
public int lastIndexOf(Object o) {
return this.processors.lastIndexOf(o);
}
代码示例来源:origin: org.eclipse.net4j/util
@Override
public int lastIndexOf(Object o)
{
try
{
lock.readLock().lock();
return super.lastIndexOf(o);
}
finally
{
lock.readLock().unlock();
}
}
代码示例来源:origin: stackoverflow.com
import java.util.*;
public class Main {
public static void main(String[] args) {
LinkedList l1=new LinkedList();
for (int i=100;i<=600;i+=100)
{
l1.add(String.valueOf(i));
}
System.out.println(l1);
System.out.println(l1.indexOf("200"));
System.out.println(l1.lastIndexOf("200"));
}
}
代码示例来源:origin: org.zkoss/zsoup
private void replaceInQueue(LinkedList<Element> queue, Element out, Element in) {
int i = queue.lastIndexOf(out);
Validate.isTrue(i != -1);
queue.remove(i);
queue.add(i, in);
}
代码示例来源:origin: astamuse/asta4d
private void replaceInQueue(LinkedList<Element> queue, Element out, Element in) {
int i = queue.lastIndexOf(out);
Validate.isTrue(i != -1);
queue.remove(i);
queue.add(i, in);
}
代码示例来源:origin: org.leapframework/leap-lang
private void replaceInQueue(LinkedList<Element> queue, Element out, Element in) {
int i = queue.lastIndexOf(out);
Validate.isTrue(i != -1);
queue.remove(i);
queue.add(i, in);
}
代码示例来源:origin: org.apache.openjpa/openjpa-all
@Override
public int lastIndexOf(Object o) {
if (!_directAccess && isDelayLoad()) {
load();
}
return super.lastIndexOf(o);
}
代码示例来源:origin: org.apache.openejb.patch/openjpa
@Override
public int lastIndexOf(Object o) {
if (!_directAccess && isDelayLoad()) {
load();
}
return super.lastIndexOf(o);
}
代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel
@Override
public int lastIndexOf(Object o) {
if (!_directAccess && isDelayLoad()) {
load();
}
return super.lastIndexOf(o);
}
代码示例来源:origin: org.apache.openjpa/openjpa-kernel
@Override
public int lastIndexOf(Object o) {
if (!_directAccess && isDelayLoad()) {
load();
}
return super.lastIndexOf(o);
}
内容来源于网络,如有侵权,请联系作者删除!