當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。