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


Java List.containsAll方法代码示例

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


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

示例1: testDuplicateImplementations2

import java.util.List; //导入方法依赖的package包/类
@Test
public void testDuplicateImplementations2(Path base) throws Exception {
    Path src = base.resolve("src");
    tb.writeJavaFiles(src,
            "module m { exports p1; provides p1.C1 with p2.C2; provides p1.C1 with p2.C2; }",
            "package p1; public class C1 { }",
            "package p2; public class C2 extends p1.C1 { }");
    Path classes = base.resolve("classes");
    Files.createDirectories(classes);

    List<String> output = new JavacTask(tb)
            .options("-XDrawDiagnostics")
            .outdir(classes)
            .files(findJavaFiles(src))
            .run(Task.Expect.FAIL)
            .writeAll()
            .getOutputLines(Task.OutputKind.DIRECT);

    List<String> expected = Arrays.asList(
            "module-info.java:1:62: compiler.err.repeated.provides.for.service: p1.C1",
            "module-info.java:1:73: compiler.err.duplicate.provides: p1.C1, p2.C2",
            "2 errors");
    if (!output.containsAll(expected)) {
        throw new Exception("Expected output not found");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:ProvidesTest.java

示例2: mainCheck

import java.util.List; //导入方法依赖的package包/类
public static boolean mainCheck(AStarHeap heap, Integer[] nums){
	System.out.println("Removing and checking " + mainToStr(nums));
	List heapInts = new ArrayList();
	List desiredInts = new ArrayList();
	for (int i = 0; i < nums.length; ++i){
		desiredInts.add(nums[i]);
		heapInts.add(heap.getMin());
		heap.deleteMin();
	}
	if ( heapInts.containsAll(desiredInts) ){
		System.out.println("OK");
		return true;
	} else {
		System.out.println("KO!");
		System.exit(1);
	}
	return false;
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:19,代码来源:AStarHeap.java

示例3: testNoNoArgConstructor

import java.util.List; //导入方法依赖的package包/类
@Test
public void testNoNoArgConstructor(Path base) throws Exception {
    Path src = base.resolve("src");
    tb.writeJavaFiles(src,
            "module m { uses p1.C1; provides p1.C1 with p2.C2; }",
            "package p1; public class C1 { }",
            "package p2; public class C2 extends p1.C1 { public C2(String str) { } }");

    List<String> output = new JavacTask(tb)
            .options("-XDrawDiagnostics")
            .outdir(Files.createDirectories(base.resolve("classes")))
            .files(findJavaFiles(src))
            .run(Task.Expect.FAIL)
            .writeAll()
            .getOutputLines(Task.OutputKind.DIRECT);

    List<String> expected = Arrays.asList(
            "module-info.java:1:46: compiler.err.service.implementation.doesnt.have.a.no.args.constructor: p2.C2");
    if (!output.containsAll(expected)) {
        throw new Exception("Expected output not found");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:ProvidesTest.java

示例4: testDuplicateUses

import java.util.List; //导入方法依赖的package包/类
@Test
public void testDuplicateUses(Path base) throws Exception {
    Path src = base.resolve("src");
    tb.writeJavaFiles(src.resolve("m"),
            "module m { uses p.C; uses p.C; }",
            "package p; public class C { }");

    List<String> output = new JavacTask(tb)
            .options("-XDrawDiagnostics")
            .outdir(Files.createDirectories(base.resolve("classes")))
            .files(findJavaFiles(src))
            .run(Task.Expect.FAIL)
            .writeAll()
            .getOutputLines(Task.OutputKind.DIRECT);

    if (!output.containsAll(Arrays.asList(
            "module-info.java:1:22: compiler.err.duplicate.uses: p.C"))) {
        throw new Exception("Expected output not found");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:UsesTest.java

示例5: testMissingService

import java.util.List; //导入方法依赖的package包/类
@Test
public void testMissingService(Path base) throws Exception {
    Path src = base.resolve("src");
    tb.writeJavaFiles(src,
            "module m { provides p.Missing with p.C; }",
            "package p; public class C extends p.Missing { }");

    List<String> output = new JavacTask(tb)
            .options("-XDrawDiagnostics")
            .outdir(Files.createDirectories(base.resolve("classes")))
            .files(findJavaFiles(src))
            .run(Task.Expect.FAIL)
            .writeAll()
            .getOutputLines(Task.OutputKind.DIRECT);

    List<String> expected = Arrays.asList(
            "C.java:1:36: compiler.err.cant.resolve.location: kindname.class, Missing, , , (compiler.misc.location: kindname.package, p, null)",
            "module-info.java:1:22: compiler.err.cant.resolve.location: kindname.class, Missing, , , (compiler.misc.location: kindname.package, p, null)",
            "2 errors");
    if (!output.containsAll(expected)) {
        throw new Exception("Expected output not found");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ProvidesTest.java

示例6: removeTargets

import java.util.List; //导入方法依赖的package包/类
public static void removeTargets(Object transitionObject, ArrayList<View> views) {
    Transition transition = (Transition) transitionObject;
    int i;
    if (transition instanceof TransitionSet) {
        TransitionSet set = (TransitionSet) transition;
        int numTransitions = set.getTransitionCount();
        for (i = 0; i < numTransitions; i++) {
            removeTargets(set.getTransitionAt(i), views);
        }
    } else if (!hasSimpleTarget(transition)) {
        List<View> targets = transition.getTargets();
        if (targets != null && targets.size() == views.size() && targets.containsAll(views)) {
            for (i = views.size() - 1; i >= 0; i--) {
                transition.removeTarget((View) views.get(i));
            }
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:19,代码来源:FragmentTransitionCompat21.java

示例7: updateFields

import java.util.List; //导入方法依赖的package包/类
public boolean updateFields(
        List<SquidSpeciesModel> squidSpeciesSpecsList,
        List<SquidRatiosModel> squidRatiosSpecsList,
        boolean useSBM, boolean userLinFits,
        int indexOfBackgroundSpecies,
        String referenceMaterialNameFilter,
        String concentrationReferenceMaterialNameFilter) {

    boolean retVal = false;

    retVal = !(this.squidSpeciesModelList.containsAll(squidSpeciesSpecsList) && squidSpeciesSpecsList.containsAll(this.squidSpeciesModelList));
    if (!retVal) {
        retVal = !(this.squidRatiosModelList.containsAll(squidRatiosSpecsList) && squidRatiosSpecsList.containsAll(this.squidRatiosModelList));
    }
    if (!retVal) {
        retVal = !(this.useSBM == useSBM);
    }
    if (!retVal) {
        retVal = !(this.userLinFits == userLinFits);
    }
    if (!retVal) {
        retVal = !(this.indexOfBackgroundSpecies == indexOfBackgroundSpecies);
    }
    if (!retVal) {
        retVal = !(this.referenceMaterialNameFilter.compareToIgnoreCase(referenceMaterialNameFilter) == 0);
    }
    if (!retVal) {
        retVal = !(this.concentrationReferenceMaterialNameFilter.compareToIgnoreCase(concentrationReferenceMaterialNameFilter) == 0);
    }

    return retVal;
}
 
开发者ID:CIRDLES,项目名称:Squid,代码行数:33,代码来源:SquidSessionModel.java

示例8: checkPrems

import java.util.List; //导入方法依赖的package包/类
/**
 * 检查权限是否越权
 */
private void checkPrems(SysRoleEntity role) {
    //如果不是超级管理员,则需要判断角色的权限是否超过自己的权限
    if (role.getCreateUserId() == Constant.SUPER_ADMIN) {
        return;
    }

    //查询用户所拥有的菜单列表
    List<Long> menuIdList = sysUserService.queryAllMenuId(role.getCreateUserId());

    //判断是否越权
    if (!menuIdList.containsAll(role.getMenuIdList())) {
        throw new RRException("新增角色的权限,已超出你的权限范围");
    }
}
 
开发者ID:davichi11,项目名称:my-spring-boot-project,代码行数:18,代码来源:SysRoleServiceImpl.java

示例9: checkAttributes

import java.util.List; //导入方法依赖的package包/类
private static void checkAttributes(LoggingMXBean mxbean1,
                                    PlatformLoggingMXBean mxbean2) {
    // verify logger names
    List<String> loggers1 = mxbean1.getLoggerNames();
    System.out.println("Loggers: " + loggers1);

    // Retrieve the named loggers to prevent them from being
    // spontaneously gc'ed.
    Map<String, Logger> loggersMap = new HashMap<>();
    for (String n : loggers1) {
        loggersMap.put(n, Logger.getLogger(n));
    }

    List<String> loggers2 = mxbean2.getLoggerNames();

    // loggers1 and loggers2 should be identical - no new logger should
    // have been created in between (at least no new logger name)
    //
    if (loggers1.size() != loggers2.size())
        throw new RuntimeException("LoggerNames: unmatched number of entries");
    if (!loggers2.containsAll(loggersMap.keySet()))
        throw new RuntimeException("LoggerNames: unmatched loggers");


    // verify logger's level  and parent
    for (String logger : loggers1) {
        String level1 = mxbean1.getLoggerLevel(logger);
        String level2 = mxbean2.getLoggerLevel(logger);
        if (!java.util.Objects.equals(level1, level2)) {
            throw new RuntimeException(
                    "LoggerLevel: unmatched level for " + logger
                    + ", " + level1 + ", " + level2);
        }

        if (!mxbean1.getParentLoggerName(logger)
                .equals(mxbean2.getParentLoggerName(logger)))
            throw new RuntimeException(
                "ParentLoggerName: unmatched parent logger's name for " + logger);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:41,代码来源:LoggingMXBeanTest.java

示例10: compareArrVals

import java.util.List; //导入方法依赖的package包/类
private boolean compareArrVals(Annotation[] actualAnnos, String[] expectedAnnos) {
    // Look if test case was run.
    if (actualAnnos == specialAnnoArray) {
        return false; // no testcase matches
    }
    if (actualAnnos.length != expectedAnnos.length) {
        System.out.println("Length not same. "
                + " actualAnnos length = " + actualAnnos.length
                + " expectedAnnos length = " + expectedAnnos.length);
        printArrContents(actualAnnos);
        printArrContents(expectedAnnos);
        return false;
    } else {
        int i = 0;
        String[] actualArr = new String[actualAnnos.length];
        for (Annotation a : actualAnnos) {
            actualArr[i++] = a.toString();
        }
        List<String> actualList = Arrays.asList(actualArr);
        List<String> expectedList = Arrays.asList(expectedAnnos);

        if (!actualList.containsAll(expectedList)) {
            System.out.println("Array values are not same");
            printArrContents(actualAnnos);
            printArrContents(expectedAnnos);
            return false;
        }
    }
    return true;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:ElementRepAnnoTester.java

示例11: calc

import java.util.List; //导入方法依赖的package包/类
public void calc(boolean plot, String gptCols, String plotFile) {
	if (plot) {
		FileHandler.writeMatrixWithId(neurons, destDir + neuronsFile, separator);
		FileHandler.appendColumn(srcFilePath, destDir + destFile, separator, winnerIds);
		String cmd = "gnuplot -c " + System.getProperty("user.dir") + "/" + plotFile + " " + gptCols;
		Utils.rumCmd(cmd);
	}

	List<List<Double>> prevDataPoints = new ArrayList<List<Double>>();
	for (int i = 0; i < iterations; i++) {
		prevDataPoints = neurons;
		calcWinnersIds();
		learn(i);

		if (plot) {
			FileHandler.writeMatrixWithId(neurons, destDir + neuronsFile, separator);
			FileHandler.appendColumn(srcFilePath, destDir + destFile, separator, winnerIds);
		}

		if (prevDataPoints.containsAll(neurons) && neurons.containsAll(prevDataPoints)) {
			break;
		}

		System.out.println(i);
	}

	FileHandler.writePointsAsClusters(winnerIds, neurons, destDir + imgcprFile, separator);
}
 
开发者ID:lukago,项目名称:neural-algorithms,代码行数:29,代码来源:KMeans.java

示例12: testImplementationMustBeInSameModuleAsProvidesDirective

import java.util.List; //导入方法依赖的package包/类
@Test
public void testImplementationMustBeInSameModuleAsProvidesDirective(Path base) throws Exception {
    Path src = base.resolve("src");
    tb.writeJavaFiles(src.resolve("m1x"),
            "module m1x { exports p1; }",
            "package p1; public class C1 { }");
    tb.writeJavaFiles(src.resolve("m2x"),
            "module m2x { requires m1x; requires m3x; provides p1.C1 with p2.C2; }");
    tb.writeJavaFiles(src.resolve("m3x"),
            "module m3x { requires m1x; exports p2; }",
            "package p2; public class C2 extends p1.C1 { }");
    Path modules = base.resolve("modules");
    Files.createDirectories(modules);

    List<String> output = new JavacTask(tb)
            .options("-XDrawDiagnostics", "--module-source-path", src.toString())
            .outdir(modules)
            .files(findJavaFiles(src))
            .run(Task.Expect.FAIL)
            .writeAll()
            .getOutputLines(Task.OutputKind.DIRECT);
    List<String> expected = Arrays.asList(
            "module-info.java:1:42: compiler.err.service.implementation.not.in.right.module: m3x",
            "1 error");
    if (!output.containsAll(expected)) {
        throw new Exception("Expected output not found");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:ServiceProvidedButNotExportedOrUsedTest.java

示例13: checkPerms

import java.util.List; //导入方法依赖的package包/类
private static void checkPerms(List<Permission> perms,
                               Permission... grantedPerms)
    throws Exception
{
    if (!perms.containsAll(Arrays.asList(grantedPerms))) {
        throw new Exception("Granted permissions not correct");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:DefineClass.java

示例14: testAP2941

import java.util.List; //导入方法依赖的package包/类
public void testAP2941(Binding binding,
            BindingOperation bindingOperation,
            BindingInput bindingInput,
            BindingOutput bindingOutput,
            Input portTypeInput,
            Output portTypeOutput) {


        if (portTypeInput != null && portTypeInput.getMessage() != null) {
            // Getting the list of all the parts bound by wsdl:input's child elements
            List inputParts = getBindingParts_AP2941(
                    bindingOperation.getBindingInput().getExtensibilityElements(),
                    (Message) portTypeInput.getMessage().get());
      
            if (!inputParts.containsAll(getPartNames(((Message) portTypeInput.getMessage().get()).getParts()))) {
                mResults.add(new Validator.ResultItem(mValidator,
                        Validator.ResultType.ERROR,
                        bindingInput,
                        NbBundle.getMessage(WSIAPValidator.class, "AP2941")));
       

            }
        }

        // If the corresponding wsdl:output exists in wsdl:portType
        // and includes the message attribute
        if (portTypeOutput != null && portTypeOutput.getMessage() != null) {
            // Getting the list of all the parts bound by wsdl:output's child elements
            List outputParts = getBindingParts_AP2941(
                    bindingOperation.getBindingOutput().getExtensibilityElements(),
                    (Message) portTypeOutput.getMessage().get());

            if (!outputParts.containsAll(getPartNames(((Message) portTypeOutput.getMessage().get()).getParts()))) {
                mResults.add(new Validator.ResultItem(mValidator,
                        Validator.ResultType.ERROR,
                        bindingOutput,
                        NbBundle.getMessage(WSIAPValidator.class, "AP2941")));
                       
            }
        }

        //this logic doesn't seem right due to the fault names or part names
      
//        if (!((Operation) bindingOperation.getOperation().get()).getFaults().isEmpty()) {
//            // Collecting all the soap:fault names
//            List faultNames = new ArrayList();
//            Collection faults = bindingOperation.getBindingFaults();
//            // Going through all the wsdl:faultS
//            Iterator it = faults.iterator();
//            while (it.hasNext()) {
//                // Getting wsdl:fault's extensibility elements
//                List extElems = ((BindingFault) it.next()).getExtensibilityElements();
//                for (int j = 0; j < extElems.size(); j++) {
//                    if (extElems.get(j) instanceof SOAPFault) {
//                        faultNames.add(((SOAPFault) extElems.get(j)).getName());
//                    }
//                }
//            }
//            //soap:fault + soap:headerfault
//            Collection <ExtensibilityElement> extEles = new ArrayList<ExtensibilityElement>();
//            extEles.addAll(bindingOperation.getBindingInput().getExtensibilityElements());
//            extEles.addAll(bindingOperation.getBindingOutput().getExtensibilityElements());
//            faultNames.addAll(findAllHeaderFaults(extEles));
//
//            // If not true that all the wsdl:faultS are bound,
//            // the assertion failed
//            if (!faultNames.containsAll(getFaultNames(((Operation) bindingOperation.getOperation().get()).getFaults()))) {
//                mResults.add(new Validator.ResultItem(mValidator,
//                        Validator.ResultType.ERROR,
//                        bindingOperation,
//                        //NbBundle.getMessage(WSIAPValidator.class, "AP2901")));
//                        "AP2941"));

//            }
//        }

    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:78,代码来源:WSIAPValidator.java

示例15: equals

import java.util.List; //导入方法依赖的package包/类
@Override
public boolean equals(Object obj) {
    boolean result = false;

    // Check for reflexivity first.
    if (this == obj) {
        return true;
    }
    if (!(obj instanceof DBTable)) {
        return false;
    }

    result = super.equals(obj);

    if (!result) {
        return result;
    }

    // Check for castability (also deals with null obj)
    if (obj instanceof DBTable) {
        DBTable aTable = (DBTable) obj;
        String aTableName = aTable.getName();
        Map<String, DBColumn> aTableColumns = aTable.getColumns();
        DBPrimaryKey aTablePK = aTable.primaryKey;
        List<DBForeignKey> aTableFKs = aTable.getForeignKeys();

        result &= (aTableName != null && name != null && name.equals(aTableName));
        if (columns != null && aTableColumns != null) {
            Set<String> objCols = aTableColumns.keySet();
            Set<String> myCols = columns.keySet();

            // Must be identical (no subsetting), hence the pair of tests.
            result &= myCols.containsAll(objCols) && objCols.containsAll(myCols);
        } else if (!(columns == null && aTableColumns == null)) {
            result = false;
        }

        result &= (primaryKey != null) ? primaryKey.equals(aTablePK) : aTablePK == null;
        if (foreignKeys != null && aTableFKs != null) {
            Collection<DBForeignKey> myFKs = foreignKeys.values();
            // Must be identical (no subsetting), hence the pair of tests.
            result &= myFKs.containsAll(aTableFKs) && aTableFKs.containsAll(myFKs);
        } else if (!(foreignKeys == null && aTableFKs == null)) {
            result = false;
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:49,代码来源:DBTable.java


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