当前位置: 首页>>代码示例>>Java>>正文


Java Collections.indexOfSubList方法代码示例

本文整理汇总了Java中java.util.Collections.indexOfSubList方法的典型用法代码示例。如果您正苦于以下问题:Java Collections.indexOfSubList方法的具体用法?Java Collections.indexOfSubList怎么用?Java Collections.indexOfSubList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Collections的用法示例。


在下文中一共展示了Collections.indexOfSubList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matches

import java.util.Collections; //导入方法依赖的package包/类
@Override
public boolean matches(Issue issue) {
	URI actualValue = getActualValue.apply(issue);
	if (actualValue == null)
		return false;

	List<String> actualSegments = actualValue.segmentsList();
	List<String> expectedSegments = expectedPattern.segmentsList();

	switch (mode) {
	case StartsWith:
		return Collections.indexOfSubList(actualSegments, expectedSegments) == 0;
	case EndsWith:
		return Collections.lastIndexOfSubList(actualSegments, expectedSegments) == actualSegments.size()
				- expectedSegments.size();
	case Equals:
		return actualSegments.equals(expectedSegments);
	}

	throw new IllegalStateException("Unknown URI property matching mode: " + mode);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:URIPropertyMatcher.java

示例2: checkForContainingAndRemoveWrongSets

import java.util.Collections; //导入方法依赖的package包/类
private static List<PeakList> checkForContainingAndRemoveWrongSets(List<PeakList> listOfPeakLists) {
    List<PeakList> tempListOfPeakLists = new ArrayList<>(listOfPeakLists);

    for (PeakList peakList1 : listOfPeakLists) {
        for (PeakList peakList2 : listOfPeakLists) {
            if (peakList1.equals(peakList2)) {
                continue;
            }
            if (Collections.indexOfSubList(peakList1.getPeakList(), peakList2.getPeakList()) != -1) {
                if (peakList1.size() > peakList2.size()) {
                    tempListOfPeakLists.remove(peakList2);
                } else if (peakList1.size() < peakList2.size()) {
                    tempListOfPeakLists.remove(peakList1);
                }
            }
        }
    }

    tempListOfPeakLists = checkIfRemovedCorrectly(tempListOfPeakLists);

    return tempListOfPeakLists;
}
 
开发者ID:protViz,项目名称:deisotoper,代码行数:23,代码来源:Deisotoper.java

示例3: isSubChain

import java.util.Collections; //导入方法依赖的package包/类
private boolean isSubChain ( final List<ViewInstanceDescriptor> descriptors )
{
    if ( this.currentChain == null || this.currentChain.isEmpty () )
    {
        return false;
    }

    final int idx = Collections.indexOfSubList ( this.currentChain, descriptors );
    return idx >= 0;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:11,代码来源:BreadcrumbNavigator.java

示例4: in

import java.util.Collections; //导入方法依赖的package包/类
private boolean in(List<String> cycle, Set<List<String>> cycles) {
    List<String> superCycle = new ArrayList<>(cycle);
    superCycle.remove(superCycle.size() - 1);
    superCycle.addAll(cycle);
    for (List<String> foundCycle: cycles) {
        if (foundCycle.size() == cycle.size() && Collections.indexOfSubList(superCycle, foundCycle) != -1)
            return true;
    }
    return false;
}
 
开发者ID:YMCoding,项目名称:kafka-0.11.0.0-src-with-comment,代码行数:11,代码来源:StickyAssignor.java

示例5: main

import java.util.Collections; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    ToolBox tb = new ToolBox();
    new JavacTask(tb).sources(TestSrc).run();

    List<String> res = new JavapTask(tb)
            .options("-v")
            .classes("AnnotationDefault.class")
            .run()
            .getOutputLines(Task.OutputKind.DIRECT);

    List<String> goldenList = tb.split(ExpectedSubstring, "\n");
    Boolean found = Collections.indexOfSubList(res, goldenList) > -1;

    Assert.check(found, "expected output not found: " + ExpectedSubstring);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:AnnotationDefaultNewlineTest.java

示例6: main

import java.util.Collections; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    ToolBox tb = new ToolBox();
    new JavacTask(tb).sources(TestSrc).run();

    List<String> res = new JavapTask(tb)
            .options("-v")
            .classes("Sample.class")
            .run()
            .getOutputLines(Task.OutputKind.DIRECT);

    List<String> expectedList = tb.split(ExpectedSubstring, "\n");
    Boolean found = Collections.indexOfSubList(res, expectedList) > -1;
    Assert.check(found, "expected output not found: " + ExpectedSubstring);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:InvisibleParameterAnnotationsTest.java

示例7: checkPath

import java.util.Collections; //导入方法依赖的package包/类
void checkPath(StandardLocation l, Mode m, List<File> expect) {
    List<File> files = getLocation(l);
    if (files == null) {
        error("location is unset: " + l);
        return;
    }

    switch (m) {
        case EQUALS:
            if (!Objects.equals(files, expect)) {
                error("location does not match the expected files: " + l);
                out.println("found:  " + files);
                out.println("expect: " + expect);
            }
            break;

        case CONTAINS:
            int containsIndex = Collections.indexOfSubList(files, expect);
            if (containsIndex == -1) {
                error("location does not contain the expected files: " + l);
                out.println("found:  " + files);
                out.println("expect: " + expect);
            }
        break;

        case STARTS_WITH:
            int startsIndex = Collections.indexOfSubList(files, expect);
            if (startsIndex != 0) {
                error("location does not start with the expected files: " + l);
                out.println("found:  " + files);
                out.println("expect: " + expect);
            }
        break;

        case ENDS_WITH:
            int endsIndex = Collections.lastIndexOfSubList(files, expect);
            if (endsIndex != files.size() - expect.size()) {
                error("location does not end with the expected files: " + l);
                out.println("found:  " + files);
                out.println("expect: " + expect);
            }
        break;

    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:46,代码来源:TestSearchPaths.java


注:本文中的java.util.Collections.indexOfSubList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。