java.util.Collections.lastIndexOfSubList()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(131)

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

Collections.lastIndexOfSubList介绍

[英]Searches the list for sublist and returns the beginning index of the last occurrence.

-1 is returned if the sublist does not exist in list.
[中]在列表中搜索子列表并返回最后一次出现的开始索引。
-如果列表中不存在子列表,则返回1。

代码示例

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

private void extractObjectAndFields(final List<Identifier> listIdentifiers, final String method,
    final String definingType) {
  final List<String> strings = listIdentifiers.stream().map(id -> id.getValue()).collect(Collectors.toList());
  int flsIndex = Collections.lastIndexOfSubList(strings, Arrays.asList(RESERVED_KEYS_FLS));
  if (flsIndex != -1) {
    String objectTypeName = strings.get(flsIndex + RESERVED_KEYS_FLS.length);
    if (!typeToDMLOperationMapping.get(definingType + ":" + objectTypeName).contains(method)) {
      typeToDMLOperationMapping.put(definingType + ":" + objectTypeName, method);
    }
  }
}

代码示例来源:origin: backport-util-concurrent/backport-util-concurrent

public static int lastIndexOfSubList(List source, List target) {
  return java.util.Collections.lastIndexOfSubList(source, target);
}

代码示例来源:origin: org.codehaus.swizzle/swizzle-jirareport

public int lastIndexOfSubList(List list, List list1) {
  return Collections.lastIndexOfSubList(list, list1);
}

代码示例来源:origin: edu.emory.mathcs.backport/com.springsource.edu.emory.mathcs.backport

public static int lastIndexOfSubList(List source, List target) {
  return java.util.Collections.lastIndexOfSubList(source, target);
}

代码示例来源:origin: net.sourceforge.pmd/pmd-apex

private void extractObjectAndFields(final List<Identifier> listIdentifiers, final String method,
    final String definingType) {
  final List<String> strings = listIdentifiers.stream().map(id -> id.getValue()).collect(Collectors.toList());
  int flsIndex = Collections.lastIndexOfSubList(strings, Arrays.asList(RESERVED_KEYS_FLS));
  if (flsIndex != -1) {
    String objectTypeName = strings.get(flsIndex + RESERVED_KEYS_FLS.length);
    if (!typeToDMLOperationMapping.get(definingType + ":" + objectTypeName).contains(method)) {
      typeToDMLOperationMapping.put(definingType + ":" + objectTypeName, method);
    }
  }
}

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

int firstIndex = Collections.indexOfSubList(source, target);
 if (firstIndex == -1 ){
   // the sublist doesn't exist
 }
 int lastIndex = Collections.lastIndexOfSubList(source, target);

代码示例来源:origin: BruceEckel/OnJava8-Examples

Collections.indexOfSubList(list, sublist));
System.out.println("lastIndexOfSubList: " +
 Collections.lastIndexOfSubList(list, sublist));
Collections.replaceAll(list, "one", "Yo");
System.out.println("replaceAll: " + list);

相关文章

微信公众号

最新文章

更多

Collections类方法