java.util.LinkedList.lastIndexOf()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中java.util.LinkedList.lastIndexOf()方法的一些代码示例,展示了LinkedList.lastIndexOf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LinkedList.lastIndexOf()方法的具体详情如下:
包路径:java.util.LinkedList
类名称:LinkedList
方法名:lastIndexOf

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

  1. @Override
  2. public int lastIndexOf(Object o)
  3. {
  4. return pipeList.lastIndexOf(o);
  5. }

代码示例来源:origin: spotbugs/spotbugs

  1. public void test4NoBugs(LinkedList<? super CharSequence> list) {
  2. list.lastIndexOf(new StringBuffer("Key"));
  3. }

代码示例来源:origin: spotbugs/spotbugs

  1. public void test4Bugs(LinkedList<? super CharSequence> list) {
  2. list.lastIndexOf(Integer.valueOf(3));
  3. }

代码示例来源:origin: org.codehaus.plexus/plexus-utils

  1. /**
  2. * This method will be called when an edge leading to given vertex was added and we want to check if introduction of
  3. * this edge has not resulted in apparition of cycle in the graph
  4. *
  5. * @param vertex
  6. * @param vertexStateMap
  7. * @return
  8. */
  9. public static List<String> introducesCycle( final Vertex vertex, final Map<Vertex, Integer> vertexStateMap )
  10. {
  11. final LinkedList<String> cycleStack = new LinkedList<String>();
  12. final boolean hasCycle = dfsVisit( vertex, cycleStack, vertexStateMap );
  13. if ( hasCycle )
  14. {
  15. // we have a situation like: [b, a, c, d, b, f, g, h].
  16. // Label of Vertex which introduced the cycle is at the first position in the list
  17. // We have to find second occurrence of this label and use its position in the list
  18. // for getting the sublist of vertex labels of cycle participants
  19. //
  20. // So in our case we are searching for [b, a, c, d, b]
  21. final String label = cycleStack.getFirst();
  22. final int pos = cycleStack.lastIndexOf( label );
  23. final List<String> cycle = cycleStack.subList( 0, pos + 1 );
  24. Collections.reverse( cycle );
  25. return cycle;
  26. }
  27. return null;
  28. }

代码示例来源:origin: neo4j/neo4j

  1. waitingThreadList.lastIndexOf( lockRequest ) );

代码示例来源:origin: apache/ignite

  1. if (sync.waitingThreads.contains(thread.getId())) {
  2. val.setChanged(nodes.lastIndexOf(thisNode) == 0);

代码示例来源:origin: it.unibo.alice.tuprolog/tuprolog

  1. @Override
  2. public int lastIndexOf(Object o) {
  3. return list.lastIndexOf(o);
  4. }

代码示例来源:origin: com.hankcs/hanlp

  1. @Override
  2. public int lastIndexOf(Object o)
  3. {
  4. return pipeList.lastIndexOf(o);
  5. }

代码示例来源:origin: org.infinispan/infinispan-embedded-query

  1. /**
  2. * @see List#lastIndexOf(Object)
  3. */
  4. @Override
  5. public int lastIndexOf(Object o) {
  6. return this.processors.lastIndexOf(o);
  7. }

代码示例来源:origin: shizuchengxuyuan/net.sz.java

  1. @Override
  2. public int lastIndexOf(Object o) {
  3. synchronized (this) {
  4. return super.lastIndexOf(o); //To change body of generated methods, choose Tools | Templates.
  5. }
  6. }

代码示例来源:origin: harbby/presto-connectors

  1. /**
  2. * @see List#lastIndexOf(Object)
  3. */
  4. @Override
  5. public int lastIndexOf(Object o) {
  6. return this.processors.lastIndexOf(o);
  7. }

代码示例来源:origin: org.eclipse.net4j/util

  1. @Override
  2. public int lastIndexOf(Object o)
  3. {
  4. try
  5. {
  6. lock.readLock().lock();
  7. return super.lastIndexOf(o);
  8. }
  9. finally
  10. {
  11. lock.readLock().unlock();
  12. }
  13. }

代码示例来源:origin: stackoverflow.com

  1. import java.util.*;
  2. public class Main {
  3. public static void main(String[] args) {
  4. LinkedList l1=new LinkedList();
  5. for (int i=100;i<=600;i+=100)
  6. {
  7. l1.add(String.valueOf(i));
  8. }
  9. System.out.println(l1);
  10. System.out.println(l1.indexOf("200"));
  11. System.out.println(l1.lastIndexOf("200"));
  12. }
  13. }

代码示例来源:origin: org.zkoss/zsoup

  1. private void replaceInQueue(LinkedList<Element> queue, Element out, Element in) {
  2. int i = queue.lastIndexOf(out);
  3. Validate.isTrue(i != -1);
  4. queue.remove(i);
  5. queue.add(i, in);
  6. }

代码示例来源:origin: astamuse/asta4d

  1. private void replaceInQueue(LinkedList<Element> queue, Element out, Element in) {
  2. int i = queue.lastIndexOf(out);
  3. Validate.isTrue(i != -1);
  4. queue.remove(i);
  5. queue.add(i, in);
  6. }

代码示例来源:origin: org.leapframework/leap-lang

  1. private void replaceInQueue(LinkedList<Element> queue, Element out, Element in) {
  2. int i = queue.lastIndexOf(out);
  3. Validate.isTrue(i != -1);
  4. queue.remove(i);
  5. queue.add(i, in);
  6. }

代码示例来源:origin: org.apache.openjpa/openjpa-all

  1. @Override
  2. public int lastIndexOf(Object o) {
  3. if (!_directAccess && isDelayLoad()) {
  4. load();
  5. }
  6. return super.lastIndexOf(o);
  7. }

代码示例来源:origin: org.apache.openejb.patch/openjpa

  1. @Override
  2. public int lastIndexOf(Object o) {
  3. if (!_directAccess && isDelayLoad()) {
  4. load();
  5. }
  6. return super.lastIndexOf(o);
  7. }

代码示例来源:origin: org.apache.openejb.patch/openjpa-kernel

  1. @Override
  2. public int lastIndexOf(Object o) {
  3. if (!_directAccess && isDelayLoad()) {
  4. load();
  5. }
  6. return super.lastIndexOf(o);
  7. }

代码示例来源:origin: org.apache.openjpa/openjpa-kernel

  1. @Override
  2. public int lastIndexOf(Object o) {
  3. if (!_directAccess && isDelayLoad()) {
  4. load();
  5. }
  6. return super.lastIndexOf(o);
  7. }

相关文章