本文整理匯總了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
}