Here are the examples of the java api class java.util.Set taken from open source projects.
1. SchemaCompilerUtil#compile()
View licensepublic static void compile(String[] args) { if (args.length == 0) { return; } Set flags = new HashSet(); flags.add("h"); flags.add("help"); flags.add("usage"); flags.add("license"); flags.add("quiet"); flags.add("verbose"); flags.add("version"); flags.add("dl"); flags.add("noupa"); flags.add("nopvr"); flags.add("noann"); flags.add("novdoc"); flags.add("noext"); flags.add("srconly"); flags.add("debug"); Set opts = new HashSet(); opts.add("out"); opts.add("name"); opts.add("src"); opts.add("d"); opts.add("cp"); opts.add("compiler"); opts.add("javasource"); // deprecated opts.add("jar"); opts.add("ms"); opts.add("mx"); opts.add("repackage"); opts.add("schemaCodePrinter"); opts.add("extension"); opts.add("extensionParms"); opts.add("allowmdef"); opts.add("catalog"); CommandLine cl = new CommandLine(args, flags, opts); String[] badopts = cl.getBadOpts(); if (badopts.length > 0) { for (int i = 0; i < badopts.length; i++) System.out.println("Unrecognized option: " + badopts[i]); return; } boolean verbose = (cl.getOpt("verbose") != null); boolean quiet = (cl.getOpt("quiet") != null); if (verbose) quiet = false; String outputfilename = cl.getOpt("out"); String repackage = cl.getOpt("repackage"); cl.getOpt("schemaCodePrinter"); SchemaCodePrinter codePrinter = null; String name = cl.getOpt("name"); boolean download = (cl.getOpt("dl") != null); boolean noUpa = (cl.getOpt("noupa") != null); boolean noPvr = (cl.getOpt("nopvr") != null); boolean noAnn = (cl.getOpt("noann") != null); boolean noVDoc = (cl.getOpt("novdoc") != null); boolean noExt = (cl.getOpt("noext") != null); boolean nojavac = (cl.getOpt("srconly") != null); boolean debug = (cl.getOpt("debug") != null); String allowmdef = cl.getOpt("allowmdef"); Set mdefNamespaces = (allowmdef == null ? Collections.EMPTY_SET : new HashSet(Arrays.asList(XmlListImpl.split_list(allowmdef)))); List extensions = new ArrayList(); String classesdir = cl.getOpt("d"); File classes = null; if (classesdir != null) classes = new File(classesdir); String srcdir = cl.getOpt("src"); File src = null; if (srcdir != null) src = new File(srcdir); if (nojavac && srcdir == null && classes != null) src = classes; // create temp directory File tempdir = null; if (src == null || classes == null) { throw new WorkflowRuntimeException("Code gen src directory or classes directory is null"); } File jarfile = null; if (outputfilename == null && classes == null && !nojavac) outputfilename = "xmltypes.jar"; if (outputfilename != null) jarfile = new File(outputfilename); if (src == null) src = IOUtil.createDir(tempdir, "src"); if (classes == null) classes = IOUtil.createDir(tempdir, "classes"); File[] classpath = null; String cpString = cl.getOpt("cp"); if (cpString != null) { String[] cpparts = cpString.split(File.pathSeparator); List cpList = new ArrayList(); for (int i = 0; i < cpparts.length; i++) cpList.add(new File(cpparts[i])); classpath = (File[]) cpList.toArray(new File[cpList.size()]); } else { classpath = CodeGenUtil.systemClasspath(); } String javasource = cl.getOpt("javasource"); String compiler = cl.getOpt("compiler"); String jar = cl.getOpt("jar"); if (verbose && jar != null) System.out.println("The 'jar' option is no longer supported."); String memoryInitialSize = cl.getOpt("ms"); String memoryMaximumSize = cl.getOpt("mx"); File[] xsdFiles = cl.filesEndingWith(".xsd"); File[] wsdlFiles = cl.filesEndingWith(".wsdl"); File[] javaFiles = cl.filesEndingWith(".java"); File[] configFiles = cl.filesEndingWith(".xsdconfig"); URL[] urlFiles = cl.getURLs(); if (xsdFiles.length + wsdlFiles.length + urlFiles.length == 0) { System.out.println("Could not find any xsd or wsdl files to process."); return; } File baseDir = cl.getBaseDir(); URI baseURI = baseDir == null ? null : baseDir.toURI(); XmlErrorPrinter err = new XmlErrorPrinter(verbose, baseURI); String catString = cl.getOpt("catalog"); Parameters params = new Parameters(); params.setBaseDir(baseDir); params.setXsdFiles(xsdFiles); params.setWsdlFiles(wsdlFiles); params.setJavaFiles(javaFiles); params.setConfigFiles(configFiles); params.setUrlFiles(urlFiles); params.setClasspath(classpath); params.setOutputJar(jarfile); params.setName(name); params.setSrcDir(src); params.setClassesDir(classes); params.setCompiler(compiler); params.setJavaSource(javasource); params.setMemoryInitialSize(memoryInitialSize); params.setMemoryMaximumSize(memoryMaximumSize); params.setNojavac(nojavac); params.setQuiet(quiet); params.setVerbose(verbose); params.setDownload(download); params.setNoUpa(noUpa); params.setNoPvr(noPvr); params.setNoAnn(noAnn); params.setNoVDoc(noVDoc); params.setNoExt(noExt); params.setDebug(debug); params.setErrorListener(err); params.setRepackage(repackage); params.setExtensions(extensions); params.setMdefNamespaces(mdefNamespaces); params.setCatalogFile(catString); params.setSchemaCodePrinter(codePrinter); compile(params); }
2. PerBtwnAllCollectionsT#printSets()
View license/** * ??Set?Add??:??????? */ @SuppressWarnings("rawtypes") private static void printSets() { Set h1 = new HashSet<String>(); h1.add("List"); h1.add("Set"); h1.add("Queue"); h1.add("Map"); System.out.println("HashSet Elements:"); System.out.print("\t" + h1 + "\n"); Set t1 = new TreeSet<String>(); t1.add("List"); t1.add("Set"); t1.add("Queue"); t1.add("Map"); System.out.println("TreeSet Elements:"); System.out.print("\t" + t1 + "\n"); }
3. UnitThrowAnalysisTest#testJArrayRef()
View license@Test public void testJArrayRef() { ArrayRef arrayRef = Jimple.v().newArrayRef(Jimple.v().newLocal("local1", ArrayType.v(RefType.v("java.lang.Object"), 1)), IntConstant.v(0)); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.NULL_POINTER_EXCEPTION); expectedRep.add(utility.ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(arrayRef))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.NULL_POINTER_EXCEPTION); expectedCatch.add(utility.ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION); expectedCatch.add(utility.INDEX_OUT_OF_BOUNDS_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(arrayRef))); }
4. UnitThrowAnalysisTest#testGArrayRef()
View license@Test public void testGArrayRef() { ArrayRef arrayRef = Grimp.v().newArrayRef(Grimp.v().newLocal("local1", ArrayType.v(RefType.v("java.lang.Object"), 1)), IntConstant.v(0)); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.NULL_POINTER_EXCEPTION); expectedRep.add(utility.ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(arrayRef))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.NULL_POINTER_EXCEPTION); expectedCatch.add(utility.ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION); expectedCatch.add(utility.INDEX_OUT_OF_BOUNDS_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(arrayRef))); }
5. UnitThrowAnalysisTest#testJExitMonitorStmt()
View license@Test public void testJExitMonitorStmt() { Stmt s = Jimple.v().newExitMonitorStmt(StringConstant.v("test")); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); expectedRep.add(utility.NULL_POINTER_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(s))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); expectedCatch.add(utility.NULL_POINTER_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(s))); }
6. UnitThrowAnalysisTest#testGExitMonitorStmt()
View license@Test public void testGExitMonitorStmt() { Stmt s = Grimp.v().newExitMonitorStmt(StringConstant.v("test")); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); expectedRep.add(utility.NULL_POINTER_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(s))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); expectedCatch.add(utility.NULL_POINTER_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(s))); }
7. ZeroConfPlugin#registerServiceListenersForAppenders()
View licenseprivate void registerServiceListenersForAppenders() { Set serviceNames = new HashSet(); serviceNames.add(MULTICAST_APPENDER_SERVICE_NAME); serviceNames.add(SOCKET_APPENDER_SERVICE_NAME); serviceNames.add(SOCKETHUB_APPENDER_SERVICE_NAME); serviceNames.add(UDP_APPENDER_SERVICE_NAME); serviceNames.add(XML_SOCKET_APPENDER_SERVICE_NAME); serviceNames.add(TCP_APPENDER_SERVICE_NAME); serviceNames.add(NEW_UDP_APPENDER_SERVICE_NAME); for (Iterator iter = serviceNames.iterator(); iter.hasNext(); ) { String serviceName = iter.next().toString(); jmDNS.addServiceListener(serviceName, new ZeroConfServiceListener()); jmDNS.addServiceListener(serviceName, discoveredDevices); } //now add each appender constant }
8. JXPathTestCase#set()
View licenseprotected static Set set(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7) { Set list = new HashSet(); list.add(o1); list.add(o2); list.add(o3); list.add(o4); list.add(o5); list.add(o6); list.add(o7); return list; }
9. JXPathTestCase#set()
View licenseprotected static Set set(Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) { Set list = new HashSet(); list.add(o1); list.add(o2); list.add(o3); list.add(o4); list.add(o5); list.add(o6); return list; }
10. HashSetT#main()
View license@SuppressWarnings({ "rawtypes", "unchecked" }) public static void main(String[] args) { Set h1 = new HashSet<String>(); h1.add("List"); h1.add(new String("List")); h1.add("List"); h1.add("Set"); h1.add("Queue"); h1.add("Map"); // ???? System.out.println("HashSet Elements:"); System.out.print("\t" + h1 + "\n"); }
11. ClientDeployableTest#testLoadClient()
View licensepublic void testLoadClient() throws Exception { URL resource = classLoader.getResource("deployables/app-client1.jar"); ClientDeployable deployable = new ClientDeployable(resource); assertEquals(ModuleType.CAR, deployable.getType()); Set entrySet = new HashSet(Collections.list(deployable.entries())); Set resultSet = new HashSet(); resultSet.add("META-INF/"); resultSet.add("META-INF/MANIFEST.MF"); resultSet.add("META-INF/application-client.xml"); resultSet.add("Main.java"); resultSet.add("Main.class"); assertEquals(resultSet, entrySet); InputStream entry = deployable.getEntry("META-INF/application-client.xml"); assertNotNull(entry); entry.close(); Class main = deployable.getClassFromScope("Main"); assertEquals("Main", main.getName()); DDBeanRoot root = deployable.getDDBeanRoot(); assertNotNull(root); assertEquals(ModuleType.CAR, root.getType()); assertEquals(deployable, root.getDeployableObject()); }
12. UnitThrowAnalysisTest#testGInstanceFieldRef()
View license@Test public void testGInstanceFieldRef() { Local local = Grimp.v().newLocal("local", utility.INCOMPATIBLE_CLASS_CHANGE_ERROR); Set expectedRep = new ExceptionHashSet(utility.VM_AND_RESOLVE_FIELD_ERRORS_REP); expectedRep.add(utility.NULL_POINTER_EXCEPTION); Set expectedCatch = new ExceptionHashSet(utility.VM_AND_RESOLVE_FIELD_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.NULL_POINTER_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); Value v = Grimp.v().newInstanceFieldRef(local, Scene.v().makeFieldRef(utility.THROWABLE.getSootClass(), "detailMessage", RefType.v("java.lang.String"), false)); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(v))); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(v))); }
13. UnitThrowAnalysisTest#testBArrayLengthInst()
View license@Test public void testBArrayLengthInst() { soot.baf.ArrayLengthInst i = soot.baf.Baf.v().newArrayLengthInst(); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.NULL_POINTER_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(i))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.NULL_POINTER_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(i))); }
14. HashSetsCopyT#main()
View license@SuppressWarnings({ "rawtypes", "unchecked" }) public static void main(String[] args) { Set s1 = new HashSet<String>(); s1.add("List"); s1.add("Queue"); s1.add("Set"); s1.add("Map"); System.out.println("HashSet Elements:"); System.out.print("\t" + s1 + "\n"); Set s2 = copy(s1); System.out.println("HashSet Elements After Copy:"); System.out.print("\t" + s2 + "\n"); }
15. UnitThrowAnalysisTest#testJEnterMonitorStmt()
View license@Test public void testJEnterMonitorStmt() { Stmt s = Jimple.v().newEnterMonitorStmt(StringConstant.v("test")); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedRep.add(utility.NULL_POINTER_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(s))); expectedCatch.add(utility.NULL_POINTER_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(s))); }
16. UnitThrowAnalysisTest#testGEnterMonitorStmt()
View license@Test public void testGEnterMonitorStmt() { Stmt s = Grimp.v().newEnterMonitorStmt(StringConstant.v("test")); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedRep.add(utility.NULL_POINTER_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(s))); expectedCatch.add(utility.NULL_POINTER_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(s))); }
17. UnitThrowAnalysisTest#testJReturnStmt()
View license@Ignore("Fails") @Test public void testJReturnStmt() { Stmt s = Jimple.v().newReturnStmt(IntConstant.v(1)); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(s))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(s))); }
18. UnitThrowAnalysisTest#testGReturnStmt()
View license@Ignore("Fails") @Test public void testGReturnStmt() { Stmt s = Grimp.v().newReturnStmt(IntConstant.v(1)); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(s))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(s))); }
19. UnitThrowAnalysisTest#testJReturnVoidStmt()
View license@Ignore("Fails") @Test public void testJReturnVoidStmt() { Stmt s = Jimple.v().newReturnVoidStmt(); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(s))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(s))); }
20. UnitThrowAnalysisTest#testGReturnVoidStmt()
View license@Ignore("Fails") @Test public void testGReturnVoidStmt() { Stmt s = Grimp.v().newReturnVoidStmt(); Set expectedRep = new ExceptionHashSet(utility.VM_ERRORS); expectedRep.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); assertTrue(ExceptionTestUtility.sameMembers(expectedRep, Collections.EMPTY_SET, unitAnalysis.mightThrow(s))); Set expectedCatch = new ExceptionHashSet(utility.VM_ERRORS_PLUS_SUPERTYPES); expectedCatch.add(utility.ILLEGAL_MONITOR_STATE_EXCEPTION); expectedCatch.add(utility.RUNTIME_EXCEPTION); expectedCatch.add(utility.EXCEPTION); assertEquals(expectedCatch, utility.catchableSubset(unitAnalysis.mightThrow(s))); }
21. CrossTransformTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { HashMap stringFeatures = new HashMap<String, Set<String>>(); Set list = new HashSet<String>(); list.add("aaa"); list.add("bbb"); stringFeatures.put("feature1", list); Set list2 = new HashSet<String>(); list2.add("11"); list2.add("22"); stringFeatures.put("feature2", list2); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); return featureVector; }
22. AssertTest#setAssertEquals()
View license@Test public void setAssertEquals() { Set expected = Sets.newHashSet(); Set actual = Sets.newHashSet(); expected.add(1); expected.add("a"); actual.add("a"); actual.add(1); Assert.assertEquals(actual, expected); }
23. ContextManagerTest#testGetCallerPrincipal()
View licensepublic void testGetCallerPrincipal() throws Exception { Subject subject = new Subject(); GeronimoUserPrincipal userPrincipal = new GeronimoUserPrincipal("foo"); RealmPrincipal realmPrincipal = new RealmPrincipal("realm", "domain", userPrincipal); PrimaryRealmPrincipal primaryRealmPrincipal = new PrimaryRealmPrincipal("realm", "domain", userPrincipal); GeronimoGroupPrincipal groupPrincipal = new GeronimoGroupPrincipal("bar"); Set principals = subject.getPrincipals(); principals.add(userPrincipal); principals.add(realmPrincipal); principals.add(primaryRealmPrincipal); principals.add(groupPrincipal); ContextManager.registerSubject(subject); Principal principal = ContextManager.getCurrentPrincipal(subject); assertSame("Expected GeronimoCallerPrincipal", userPrincipal, principal); }
24. TransducerGraph#getArc()
View license/** * Slow implementation. */ public Arc getArc(Object source, Object target) { Set arcsFromSource = arcsBySource.get(source); Set arcsToTarget = arcsByTarget.get(target); Set result = Generics.newHashSet(); result.addAll(arcsFromSource); // intersection result.retainAll(arcsToTarget); if (result.size() < 1) { return null; } if (result.size() > 1) { throw new RuntimeException("Problem in TransducerGraph data structures."); } // get the only member Iterator iterator = result.iterator(); return (Arc) iterator.next(); }
25. AbstractXMLReaderTest#testExposesAttributesKeysAsIterator()
View licensepublic void testExposesAttributesKeysAsIterator() throws Exception { HierarchicalStreamReader xmlReader = createReader("<node hello='world' a='b' c='d'><empty/></node>"); Set expected = new HashSet(); expected.add("hello"); expected.add("a"); expected.add("c"); Set actual = new HashSet(); Iterator iterator; iterator = xmlReader.getAttributeNames(); while (iterator.hasNext()) { actual.add(iterator.next()); } assertEquals(expected, actual); // again, to check iteration is repeatable iterator = xmlReader.getAttributeNames(); while (iterator.hasNext()) { actual.add(iterator.next()); } assertEquals(expected, actual); }
26. ZipsTest#testIterateAndBreak()
View licensepublic void testIterateAndBreak() { File src = new File("src/test/resources/demo.zip"); final Set files = new HashSet(); files.add("foo.txt"); files.add("bar.txt"); files.add("foo1.txt"); files.add("foo2.txt"); Zips.get(src).iterate(new ZipEntryCallback() { public void process(InputStream in, ZipEntry zipEntry) throws IOException { files.remove(zipEntry.getName()); throw new ZipBreakException(); } }); assertEquals(3, files.size()); }
27. ZipUtilTest#testIterate()
View licensepublic void testIterate() { File src = file("demo.zip"); final Set files = new HashSet(); files.add("foo.txt"); files.add("bar.txt"); files.add("foo1.txt"); files.add("foo2.txt"); ZipUtil.iterate(src, new ZipInfoCallback() { public void process(ZipEntry zipEntry) throws IOException { files.remove(zipEntry.getName()); } }); assertEquals(0, files.size()); }
28. ZipUtilTest#testIterateGivenEntriesZipInfoCallback()
View licensepublic void testIterateGivenEntriesZipInfoCallback() { File src = file("demo.zip"); final Set files = new HashSet(); files.add("foo.txt"); files.add("bar.txt"); files.add("foo1.txt"); files.add("foo2.txt"); ZipUtil.iterate(src, new String[] { "foo.txt", "foo1.txt", "foo2.txt" }, new ZipInfoCallback() { public void process(ZipEntry zipEntry) throws IOException { files.remove(zipEntry.getName()); } }); assertEquals(1, files.size()); assertTrue("Wrong entry hasn't been iterated", files.contains("bar.txt")); }
29. ZipUtilTest#testIterateGivenEntriesZipEntryCallback()
View licensepublic void testIterateGivenEntriesZipEntryCallback() { File src = file("demo.zip"); final Set files = new HashSet(); files.add("foo.txt"); files.add("bar.txt"); files.add("foo1.txt"); files.add("foo2.txt"); ZipUtil.iterate(src, new String[] { "foo.txt", "foo1.txt", "foo2.txt" }, new ZipEntryCallback() { public void process(InputStream in, ZipEntry zipEntry) throws IOException { files.remove(zipEntry.getName()); } }); assertEquals(1, files.size()); assertTrue("Wrong entry hasn't been iterated", files.contains("bar.txt")); }
30. ZipUtilTest#testIterateGivenEntriesFromStream()
View licensepublic void testIterateGivenEntriesFromStream() throws IOException { File src = file("demo.zip"); final Set files = new HashSet(); files.add("foo.txt"); files.add("bar.txt"); files.add("foo1.txt"); files.add("foo2.txt"); FileInputStream inputStream = null; try { inputStream = new FileInputStream(src); ZipUtil.iterate(inputStream, new String[] { "foo.txt", "foo1.txt", "foo2.txt" }, new ZipEntryCallback() { public void process(InputStream in, ZipEntry zipEntry) throws IOException { files.remove(zipEntry.getName()); } }); assertEquals(1, files.size()); assertTrue("Wrong entry hasn't been iterated", files.contains("bar.txt")); } finally { if (inputStream != null) { inputStream.close(); } } }
31. ZipUtilTest#testIterateAndBreak()
View licensepublic void testIterateAndBreak() { File src = file("demo.zip"); final Set files = new HashSet(); files.add("foo.txt"); files.add("bar.txt"); files.add("foo1.txt"); files.add("foo2.txt"); ZipUtil.iterate(src, new ZipEntryCallback() { public void process(InputStream in, ZipEntry zipEntry) throws IOException { files.remove(zipEntry.getName()); throw new ZipBreakException(); } }); assertEquals(3, files.size()); }
32. ConcurrentHashMap8Test#testEquals()
View license/** * KeySets with equal elements are equal */ public void testEquals() { Set a = populatedSet(3); Set b = populatedSet(3); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); a.add(m1); assertFalse(a.equals(b)); assertFalse(b.equals(a)); b.add(m1); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); }
33. BasicDependencyManager#addDependency()
View license/** * Declares a dependency from a child to a parent. * * @param child the dependent component * @param parent the component the child is depending on */ public synchronized void addDependency(ObjectName child, ObjectName parent) { Set parents = (Set) childToParentMap.get(child); if (parents == null) { parents = new HashSet(); childToParentMap.put(child, parents); } parents.add(parent); Set children = (Set) parentToChildMap.get(parent); if (children == null) { children = new HashSet(); parentToChildMap.put(parent, children); } children.add(child); }
34. DefaultObjectWrapperTest#testLegacyNonListCollectionWrapping()
View license@Test public void testLegacyNonListCollectionWrapping() throws TemplateModelException { Set set = new TreeSet(); set.add("a"); set.add("b"); set.add("c"); TemplateSequenceModel seq = (TemplateSequenceModel) OW22.wrap(set); assertTrue(seq instanceof SimpleSequence); assertEquals(3, seq.size()); assertEquals("a", OW22.unwrap(seq.get(0))); assertEquals("b", OW22.unwrap(seq.get(1))); assertEquals("c", OW22.unwrap(seq.get(2))); }
35. NarMojo#filterMarkedDependencies()
View licenseprotected DependencyStatusSets filterMarkedDependencies(Set artifacts) throws MojoExecutionException { // remove files that have markers already FilterArtifacts filter = new FilterArtifacts(); filter.clearFilters(); filter.addFilter(getMarkedArtifactFilter()); Set unMarkedArtifacts; try { unMarkedArtifacts = filter.filter(artifacts); } catch (ArtifactFilterException e) { throw new MojoExecutionException(e.getMessage(), e); } // calculate the skipped artifacts Set skippedArtifacts = new HashSet(); skippedArtifacts.addAll(artifacts); skippedArtifacts.removeAll(unMarkedArtifacts); return new DependencyStatusSets(unMarkedArtifacts, null, skippedArtifacts); }
36. ConcurrentHashMap8Test#testKeySetAddRemove()
View license/** * keySet.add adds the key with the established value to the map; * remove removes it. */ public void testKeySetAddRemove() { ConcurrentHashMap map = map5(); Set set1 = map.keySet(); Set set2 = map.keySet(true); set2.add(six); assertTrue(((ConcurrentHashMap.KeySetView) set2).getMap() == map); assertTrue(((ConcurrentHashMap.KeySetView) set1).getMap() == map); assertEquals(set2.size(), map.size()); assertEquals(set1.size(), map.size()); assertTrue((Boolean) map.get(six)); assertTrue(set1.contains(six)); assertTrue(set2.contains(six)); set2.remove(six); assertNull(map.get(six)); assertFalse(set1.contains(six)); assertFalse(set2.contains(six)); }
37. ConcurrentHashMap8Test#testEquals()
View license/** * KeySets with equal elements are equal */ public void testEquals() { Set a = populatedSet(3); Set b = populatedSet(3); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); a.add(m1); assertFalse(a.equals(b)); assertFalse(b.equals(a)); b.add(m1); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); }
38. ObsTest#setGroupMembers_shouldMarkTheObsAsDirtyWhenTheSetIsReplacedWithAnotherWithDifferentMembers()
View license/** * @see Obs#setGroupMembers(Set) * @verifies mark the obs as dirty when the set is replaced with another with different members */ @Test public void setGroupMembers_shouldMarkTheObsAsDirtyWhenTheSetIsReplacedWithAnotherWithDifferentMembers() throws Exception { Obs obs = new Obs(); Set members1 = new HashSet<>(); members1.add(new Obs()); obs.setGroupMembers(members1); resetObs(obs); Set members2 = new HashSet<>(); members2.add(new Obs()); obs.setGroupMembers(members2); assertTrue(obs.isDirty()); }
39. ObsTest#setGroupMembers_shouldNotMarkTheObsAsDirtyWhenTheSetIsReplacedWithAnotherWithSameMembers()
View license/** * @see Obs#setGroupMembers(Set) * @verifies not mark the obs as dirty when the set is replaced with another with same members */ @Test public void setGroupMembers_shouldNotMarkTheObsAsDirtyWhenTheSetIsReplacedWithAnotherWithSameMembers() throws Exception { Obs obs = new Obs(); Obs o = new Obs(); Set members1 = new HashSet<>(); members1.add(o); obs.setGroupMembers(members1); resetObs(obs); Set members2 = new HashSet<>(); members2.add(o); obs.setGroupMembers(members2); assertFalse(obs.isDirty()); }
40. ConcurrentHashMap8Test#testKeySetAddRemove()
View license/** * keySet.add adds the key with the established value to the map; * remove removes it. */ public void testKeySetAddRemove() { ConcurrentHashMap map = map5(); Set set1 = map.keySet(); Set set2 = map.keySet(true); set2.add(six); assertTrue(((ConcurrentHashMap.KeySetView) set2).getMap() == map); assertTrue(((ConcurrentHashMap.KeySetView) set1).getMap() == map); assertEquals(set2.size(), map.size()); assertEquals(set1.size(), map.size()); assertTrue((Boolean) map.get(six)); assertTrue(set1.contains(six)); assertTrue(set2.contains(six)); set2.remove(six); assertNull(map.get(six)); assertFalse(set1.contains(six)); assertFalse(set2.contains(six)); }
41. ConcurrentHashMap8Test#testEquals()
View license/** * KeySets with equal elements are equal */ public void testEquals() { Set a = populatedSet(3); Set b = populatedSet(3); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); a.add(m1); assertFalse(a.equals(b)); assertFalse(b.equals(a)); b.add(m1); assertTrue(a.equals(b)); assertTrue(b.equals(a)); assertEquals(a.hashCode(), b.hashCode()); }
42. CmSynchronizer#reconcileOfficialInstructors()
View licenseprotected void reconcileOfficialInstructors(Element esElement, EnrollmentSet enrollmentSet) { List newInstructorElements = esElement.getChild("official-instructors").getChildren("official-instructor"); Set newUserEids = new HashSet(); for (Iterator iter = newInstructorElements.iterator(); iter.hasNext(); ) { String userEid = ((Element) iter.next()).getText(); newUserEids.add(userEid); } Set officialInstructors = enrollmentSet.getOfficialInstructors(); if (officialInstructors == null) { officialInstructors = new HashSet(); enrollmentSet.setOfficialInstructors(officialInstructors); } officialInstructors.clear(); officialInstructors.addAll(newUserEids); cmAdmin.updateEnrollmentSet(enrollmentSet); }
43. ItemService#cloneItem()
View licensepublic ItemData cloneItem(ItemDataIfc item) { ItemData cloned = new ItemData(item.getSection(), item.getSequence(), item.getDuration(), item.getInstruction(), item.getDescription(), item.getTypeId(), item.getGrade(), item.getScore(), item.getScoreDisplayFlag(), item.getDiscount(), item.getMinScore(), item.getHint(), item.getHasRationale(), item.getStatus(), item.getCreatedBy(), item.getCreatedDate(), item.getLastModifiedBy(), item.getLastModifiedDate(), null, null, null, item.getTriesAllowed(), item.getPartialCreditFlag()); // perform deep copy, set ItemTextSet, itemMetaDataSet and itemFeedbackSet Set newItemTextSet = copyItemTextSet(cloned, item.getItemTextSet()); Set newItemMetaDataSet = copyItemMetaDataSet(cloned, item.getItemMetaDataSet()); Set newItemFeedbackSet = copyItemFeedbackSet(cloned, item.getItemFeedbackSet()); Set newItemAttachmentSet = copyItemAttachmentSet(cloned, item.getItemAttachmentSet()); String newItemInstruction = AssessmentService.copyStringAttachment(item.getInstruction()); cloned.setItemTextSet(newItemTextSet); cloned.setItemMetaDataSet(newItemMetaDataSet); cloned.setItemFeedbackSet(newItemFeedbackSet); cloned.setItemAttachmentSet(newItemAttachmentSet); cloned.setAnswerOptionsSimpleOrRich(item.getAnswerOptionsSimpleOrRich()); cloned.setAnswerOptionsRichCount(item.getAnswerOptionsRichCount()); cloned.setInstruction(newItemInstruction); return cloned; }
44. LinearModelTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { Set list = new HashSet<String>(); list.add("aaa"); list.add("bbb"); // add a feature that is missing in the model list.add("ccc"); HashMap stringFeatures = new HashMap<String, ArrayList<String>>(); stringFeatures.put("string_feature", list); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); return featureVector; }
45. DateDiffTransformTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { Map<String, Set<String>> stringFeatures = new HashMap<>(); Map<String, Map<String, Double>> floatFeatures = new HashMap<>(); Set endDates = new HashSet<String>(); Set startDates = new HashSet<String>(); endDates.add("2009-03-01"); startDates.add("2009-02-27"); stringFeatures.put("endDates", endDates); stringFeatures.put("startDates", startDates); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); featureVector.setFloatFeatures(floatFeatures); return featureVector; }
46. StringCrossFloatTransformTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { Map<String, Set<String>> stringFeatures = new HashMap<>(); Map<String, Map<String, Double>> floatFeatures = new HashMap<>(); Set list = new HashSet<String>(); list.add("aaa"); list.add("b:bb"); list.add("c:cc"); stringFeatures.put("strFeature1", list); Map<String, Double> map = new HashMap<>(); map.put("lat", 37.7); map.put("long", 40.0); floatFeatures.put("loc", map); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); featureVector.setFloatFeatures(floatFeatures); return featureVector; }
47. X509StoreLDAPAttrCerts#engineGetMatches()
View license/** * Returns a collection of matching attribute certificates from the LDAP * location. * <p> * The selector must be a of type * <code>X509AttributeCertStoreSelector</code>. If it is not an empty * collection is returned. * </p> * <p> * The subject and the serial number should be reasonable criterias for a * selector. * </p> * @param selector The selector to use for finding. * @return A collection with the matches. * @throws StoreException if an exception occurs while searching. */ public Collection engineGetMatches(Selector selector) throws StoreException { if (!(selector instanceof X509AttributeCertStoreSelector)) { return Collections.EMPTY_SET; } X509AttributeCertStoreSelector xselector = (X509AttributeCertStoreSelector) selector; Set set = new HashSet(); set.addAll(helper.getAACertificates(xselector)); set.addAll(helper.getAttributeCertificateAttributes(xselector)); set.addAll(helper.getAttributeDescriptorCertificates(xselector)); return set; }
48. CollectionsTest#testLinkedHashSetRetainsOrdering()
View licensepublic void testLinkedHashSetRetainsOrdering() { Set set = new LinkedHashSet(); set.add("Z"); set.add("C"); set.add("X"); LinkedHashSet result = (LinkedHashSet) assertBothWays(set, "<linked-hash-set>\n" + " <string>Z</string>\n" + " <string>C</string>\n" + " <string>X</string>\n" + "</linked-hash-set>"); Object[] values = result.toArray(); assertEquals("Z", values[0]); assertEquals("C", values[1]); assertEquals("X", values[2]); }
49. VirtualInstanceFactoryTest#testFindGuestsWithoutAHostByOrg()
View license/** * Commeting out test for satellite. public void testFindGuestsWithNonVirtHostByOrg() throws Exception { Set expectedViews = new HashSet(); expectedViews.add(builder.createGuest().withNonVirtHost() .withPersistence().build().asGuestAndNonVirtHostView()); expectedViews.add(builder.createGuest().withNonVirtHost() .withPersistence().build().asGuestAndNonVirtHostView()); expectedViews.add(builder.createGuest().withNonVirtHostInAnotherOrg() .withPersistence().build().asGuestAndNonVirtHostView()); expectedViews.add(builder.createGuest().withVirtHostInAnotherOrg() .withPersistence().build().asGuestAndNonVirtHostView()); builder.createGuest().withVirtHost().withPersistence().build(); builder.createGuest().withPersistence().build(); Set actualViews = virtualInstanceDAO .findGuestsWithNonVirtHostByOrg(user.getOrg()); assertTrue(CollectionUtils .isEqualCollection(expectedViews, actualViews)); }*/ public void testFindGuestsWithoutAHostByOrg() throws Exception { Set expectedViews = new HashSet(); expectedViews.add(builder.createGuest().withPersistence().build().asGuestAndNonVirtHostView()); expectedViews.add(builder.createGuest().withPersistence().build().asGuestAndNonVirtHostView()); builder.createGuest().withNonVirtHostInAnotherOrg().withPersistence().build(); builder.createGuest().withNonVirtHost().withPersistence().build(); builder.createGuest().withVirtHost().withPersistence().build(); Set actualViews = virtualInstanceDAO.findGuestsWithoutAHostByOrg(user.getOrg()); assertTrue(CollectionUtils.isEqualCollection(expectedViews, actualViews)); }
50. X509CRLObject#hasUnsupportedCriticalExtension()
View license/** * Will return true if any extensions are present and marked * as critical as we currently dont handle any extensions! */ public boolean hasUnsupportedCriticalExtension() { Set extns = getCriticalExtensionOIDs(); if (extns == null) { return false; } extns.remove(RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT); extns.remove(RFC3280CertPathUtilities.DELTA_CRL_INDICATOR); return !extns.isEmpty(); }
51. SetAssert_raw_set_assertions_chained_after_superclass_method_Test#test_bug_485()
Project: assertj-core
Source File: SetAssert_raw_set_assertions_chained_after_superclass_method_Test.java
View licenseSource File: SetAssert_raw_set_assertions_chained_after_superclass_method_Test.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void test_bug_485() { // https://github.com/joel-costigliola/assertj-core/issues/485 Set set = new java.util.HashSet<>(); set.add("Key1"); set.add("Key2"); assertThat(set).as("").contains("Key1", "Key2"); assertThat(set).as("").containsOnly("Key1", "Key2"); }
52. SelfCrossTransformTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { HashMap stringFeatures = new HashMap<String, Set<String>>(); Set list = new HashSet<String>(); list.add("aaa"); list.add("bbb"); stringFeatures.put("feature1", list); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); return featureVector; }
53. ListTransformTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { Map<String, Set<String>> stringFeatures = new HashMap<>(); Map<String, Map<String, Double>> floatFeatures = new HashMap<>(); Set list = new HashSet<String>(); list.add("aaa"); list.add("bbb"); stringFeatures.put("strFeature1", list); Map<String, Double> map = new HashMap<>(); map.put("lat", 37.7); map.put("long", 40.0); floatFeatures.put("loc", map); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); featureVector.setFloatFeatures(floatFeatures); return featureVector; }
54. DefaultStringTokenizerTransformTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { Map<String, Set<String>> stringFeatures = new HashMap<>(); Map<String, Map<String, Double>> floatFeatures = new HashMap<>(); Set list = new HashSet<String>(); list.add("I like blueberry pie, apple pie; and I also like blue!"); list.add("I'm so excited: I like blue!?!!"); stringFeatures.put("strFeature1", list); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); featureVector.setFloatFeatures(floatFeatures); return featureVector; }
55. DateValTransformTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { Map<String, Set<String>> stringFeatures = new HashMap<>(); Map<String, Map<String, Double>> floatFeatures = new HashMap<>(); Set dates = new HashSet<String>(); dates.add("2009-03-01"); dates.add("2009-02-27"); stringFeatures.put("dates", dates); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); featureVector.setFloatFeatures(floatFeatures); return featureVector; }
56. CustomMultiscaleQuantizeTransformTest#makeFeatureVector()
View licensepublic FeatureVector makeFeatureVector() { Map<String, Set<String>> stringFeatures = new HashMap<>(); Map<String, Map<String, Double>> floatFeatures = new HashMap<>(); Set list = new HashSet<String>(); list.add("aaa"); list.add("bbb"); stringFeatures.put("strFeature1", list); Map<String, Double> map = new HashMap<>(); map.put("lat", 37.7); map.put("long", 40.0); map.put("zero", 0.0); map.put("negative", -1.0); floatFeatures.put("loc", map); FeatureVector featureVector = new FeatureVector(); featureVector.setStringFeatures(stringFeatures); featureVector.setFloatFeatures(floatFeatures); return featureVector; }
57. X509CRLObject#hasUnsupportedCriticalExtension()
View license/** * Will return true if any extensions are present and marked * as critical as we currently dont handle any extensions! */ public boolean hasUnsupportedCriticalExtension() { Set extns = getCriticalExtensionOIDs(); if (extns == null) { return false; } extns.remove(Extension.issuingDistributionPoint.getId()); extns.remove(Extension.deltaCRLIndicator.getId()); return !extns.isEmpty(); }
58. X509CRLObject#hasUnsupportedCriticalExtension()
View license/** * Will return true if any extensions are present and marked * as critical as we currently dont handle any extensions! */ public boolean hasUnsupportedCriticalExtension() { Set extns = getCriticalExtensionOIDs(); if (extns == null) { return false; } extns.remove(RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT); extns.remove(RFC3280CertPathUtilities.DELTA_CRL_INDICATOR); return !extns.isEmpty(); }
59. X509CRLObject#hasUnsupportedCriticalExtension()
View license/** * Will return true if any extensions are present and marked * as critical as we currently dont handle any extensions! */ public boolean hasUnsupportedCriticalExtension() { Set extns = getCriticalExtensionOIDs(); if (extns == null) { return false; } extns.remove(RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT); extns.remove(RFC3280CertPathUtilities.DELTA_CRL_INDICATOR); return !extns.isEmpty(); }
60. HTreeSetTest#issue116_isEmpty()
View license@Test public void issue116_isEmpty() { File f = TT.tempFile(); Set s = DBMaker.fileDB(f.getPath()).make().hashSet("name").make(); assertTrue(s.isEmpty()); assertEquals(0, s.size()); s.add("aa"); assertEquals(1, s.size()); assertFalse(s.isEmpty()); s.remove("aa"); assertTrue(s.isEmpty()); assertEquals(0, s.size()); f.delete(); }
61. Operation#getAllFaultsSet()
View licensepublic Set<Fault> getAllFaultsSet() { Set transSet = new HashSet(); transSet.addAll(_faults); Iterator iter = _faults.iterator(); Fault fault; Set tmpSet; while (iter.hasNext()) { tmpSet = ((Fault) iter.next()).getAllFaultsSet(); transSet.addAll(tmpSet); } return transSet; }
62. X509CRLObject#hasUnsupportedCriticalExtension()
View license/** * Will return true if any extensions are present and marked * as critical as we currently dont handle any extensions! */ public boolean hasUnsupportedCriticalExtension() { Set extns = getCriticalExtensionOIDs(); if (extns == null) { return false; } extns.remove(Extension.issuingDistributionPoint.getId()); extns.remove(Extension.deltaCRLIndicator.getId()); return !extns.isEmpty(); }
63. CourseManagementServiceTest#testIsEnrolled()
View license@Test public void testIsEnrolled() throws Exception { Set enrollmentSetEids = new HashSet(); enrollmentSetEids.add("BIO101_F2006_01_ES01"); // We don't care about bad EnrollmentSet eids here... we're just interested in Enrollments enrollmentSetEids.add("bad eid"); Assert.assertTrue(cm.isEnrolled("josh", enrollmentSetEids)); // Graders are not enrolled Assert.assertTrue(!cm.isEnrolled("grader1", enrollmentSetEids)); Assert.assertTrue(!cm.isEnrolled("grader2", enrollmentSetEids)); }
64. CertificatePropertiesFileLoginModule#commit()
View licensepublic boolean commit() throws LoginException { Set principals = subject.getPrincipals(); principals.add(principal); String userName = (String) users.get(principal.getName()); principals.add(new GeronimoUserPrincipal(userName)); Iterator e = groups.keySet().iterator(); while (e.hasNext()) { String groupName = (String) e.next(); Set users = (Set) groups.get(groupName); Iterator iter = users.iterator(); while (iter.hasNext()) { String user = (String) iter.next(); if (userName.equals(user)) { principals.add(new GeronimoGroupPrincipal(groupName)); break; } } } return true; }
65. GBeanNameTest#testEquals()
View licensepublic void testEquals() { GBeanName name = new GBeanName("testDomain:prop1=value1,prop2=value2"); assertEquals(name, name); assertEquals(new GBeanName("testDomain:prop2=value2,prop1=value1"), name); assertFalse(name.equals(new GBeanName("foo:prop1=value1,prop2=value2"))); assertFalse(name.equals(new GBeanName("testDomain:prop1=value1"))); assertFalse(name.equals(new GBeanName("testDomain:prop2=value2"))); assertFalse(name.equals(new GBeanName("testDomain:prop2=value2"))); assertFalse(name.equals(new GBeanName("testDomain:prop1=value1,prop2=value2,prop3=value3"))); Set set = new HashSet(); set.add(name); set.add(name); assertEquals(1, set.size()); }
66. NestedHS#payload()
View licensestatic byte[] payload() throws IOException { Set root = new HashSet(); Set s1 = root; Set s2 = new HashSet(); for (int i = 0; i < 100; i++) { Set t1 = new HashSet(); Set t2 = new HashSet(); // make it not equal to t2 t1.add("foo"); s1.add(t1); s1.add(t2); s2.add(t1); s2.add(t2); s1 = t1; s2 = t2; } return serialize(root); }
67. GroupCategorySet#union()
View license/** * Creates a new group category set containing the union of the given two * group category sets * * @param one the first set of group categories * @param two the second set of group categories * * @return the union */ public static GroupCategorySet union(GroupCategorySet one, GroupCategorySet two) { Assert.isNotNull(one); Assert.isNotNull(two); // therefore best used as static final fields. if (one == two) return one; if (one == NONE) return two; if (two == NONE) return one; Set combined = new HashSet(); combined.addAll(one.asList()); combined.addAll(two.asList()); return new GroupCategorySet(combined); }
68. Namespace#getPageNames()
View licensepublic List getPageNames() { Set names = new HashSet(); names.addAll(_pages.keySet()); names.addAll(_specification.getPageNames()); List result = new ArrayList(names); Collections.sort(result); return result; }
69. UserPaneTest#addPanes()
View licenseprivate List addPanes() { List panes = new ArrayList(PaneFactory.getAllPanes().values()); UserFactory.save(user); Long id = user.getId(); user = null; user = UserFactory.lookupById(id); Set userPanes = new HashSet(); userPanes.add(panes.get(0)); userPanes.add(panes.get(1)); user.setHiddenPanes(userPanes); UserFactory.save(user); user = null; user = UserFactory.lookupById(id); assertEquals(new HashSet(panes.subList(0, 2)), new HashSet(user.getHiddenPanes())); return panes.subList(0, 2); }
70. Sample#addSuppliers()
View license/** * Populate the supplier entities in the database. If the supplier set is * not empty, assume that this has already been done. */ private void addSuppliers() { Set suppliers = views.getSupplierSet(); if (suppliers.isEmpty()) { System.out.println("Adding Suppliers"); suppliers.add(new Supplier("S1", "Smith", 20, "London")); suppliers.add(new Supplier("S2", "Jones", 10, "Paris")); suppliers.add(new Supplier("S3", "Blake", 30, "Paris")); suppliers.add(new Supplier("S4", "Clark", 20, "London")); suppliers.add(new Supplier("S5", "Adams", 30, "Athens")); } }
71. Sample#addShipments()
View license/** * Populate the shipment entities in the database. If the shipment set * is not empty, assume that this has already been done. */ private void addShipments() { Set shipments = views.getShipmentSet(); if (shipments.isEmpty()) { System.out.println("Adding Shipments"); shipments.add(new Shipment("P1", "S1", 300)); shipments.add(new Shipment("P2", "S1", 200)); shipments.add(new Shipment("P3", "S1", 400)); shipments.add(new Shipment("P4", "S1", 200)); shipments.add(new Shipment("P5", "S1", 100)); shipments.add(new Shipment("P6", "S1", 100)); shipments.add(new Shipment("P1", "S2", 300)); shipments.add(new Shipment("P2", "S2", 400)); shipments.add(new Shipment("P2", "S3", 200)); shipments.add(new Shipment("P2", "S4", 200)); shipments.add(new Shipment("P4", "S4", 300)); shipments.add(new Shipment("P5", "S4", 400)); } }
72. DefaultObjectWrapperTest#testCollectionAdapterAndNulls()
View license@Test public void testCollectionAdapterAndNulls() throws TemplateModelException { Set set = new HashSet(); set.add(null); { DefaultObjectWrapper dow = new DefaultObjectWrapper(Configuration.VERSION_2_3_22); dow.setForceLegacyNonListCollections(false); TemplateCollectionModelEx coll = (TemplateCollectionModelEx) dow.wrap(set); assertEquals(1, coll.size()); assertFalse(coll.isEmpty()); assertNull(coll.iterator().next()); } { DefaultObjectWrapper dow = new DefaultObjectWrapper(Configuration.VERSION_2_3_22); dow.setForceLegacyNonListCollections(false); dow.setNullModel(NullModel.INSTANCE); TemplateCollectionModelEx coll = (TemplateCollectionModelEx) dow.wrap(set); assertEquals(1, coll.size()); assertFalse(coll.isEmpty()); assertEquals(NullModel.INSTANCE, coll.iterator().next()); } }
73. HashMapTest#test_entrySet()
View license/** * java.util.HashMap#entrySet() */ public void test_entrySet() { // Test for method java.util.Set java.util.HashMap.entrySet() Set s = hm.entrySet(); Iterator i = s.iterator(); assertTrue("Returned set of incorrect size", hm.size() == s.size()); while (i.hasNext()) { Map.Entry m = (Map.Entry) i.next(); assertTrue("Returned incorrect entry set", hm.containsKey(m.getKey()) && hm.containsValue(m.getValue())); } Iterator iter = s.iterator(); s.remove(iter.next()); assertEquals(1001, s.size()); }
74. HashMapTest#test_EntrySet()
View license/* * Regression test for HY-4750 */ public void test_EntrySet() { HashMap map = new HashMap(); map.put(new Integer(1), "ONE"); Set entrySet = map.entrySet(); Iterator e = entrySet.iterator(); Object real = e.next(); Map.Entry copyEntry = new MockEntry(); assertEquals(real, copyEntry); assertTrue(entrySet.contains(copyEntry)); entrySet.remove(copyEntry); assertFalse(entrySet.contains(copyEntry)); }
75. HashtableTest#test_clone()
View license/** * java.util.Hashtable#clone() */ public void test_clone() { // Test for method java.lang.Object java.util.Hashtable.clone() Hashtable h = (Hashtable) htfull.clone(); assertTrue("Clone different size than original", h.size() == htfull.size()); Set org = htfull.keySet(); Set cpy = h.keySet(); for (Object key : org) { assertTrue("Key comparison failed", cpy.contains(key)); assertEquals("Value comparison failed", htfull.get(key), h.get(key)); } }
76. IdentityHashMapTest#test_entrySet_removeAll()
View license/** * @tests java.util.IdentityHashMap#entrySet() * @tests java.util.IdentityHashMap#remove(java.lang.Object) */ public void test_entrySet_removeAll() { IdentityHashMap map = new IdentityHashMap(); for (int i = 0; i < 1000; i++) { map.put(new Integer(i), new Integer(i)); } Set set = map.entrySet(); set.removeAll(set); assertEquals("did not remove all elements in the map", 0, map.size()); assertTrue("did not remove all elements in the entryset", set.isEmpty()); Iterator it = set.iterator(); assertTrue("entrySet iterator still has elements", !it.hasNext()); }
77. IdentityHashMapTest#test_keySet_clear()
View license/** * @tests java.util.IdentityHashMap#keySet() * @tests java.util.IdentityHashMap#clear() */ public void test_keySet_clear() { IdentityHashMap map = new IdentityHashMap(); for (int i = 0; i < 1000; i++) { map.put(new Integer(i), new Integer(i)); } Set set = map.keySet(); set.clear(); assertEquals("did not remove all elements in the map", 0, map.size()); assertTrue("did not remove all elements in the keyset", set.isEmpty()); Iterator it = set.iterator(); assertTrue("keySet iterator still has elements", !it.hasNext()); }
78. IdentityHashMapTest#test_keySet_removeAll()
View license/** * @tests java.util.IdentityHashMap#keySet() * @tests java.util.IdentityHashMap#remove(java.lang.Object) */ public void test_keySet_removeAll() { IdentityHashMap map = new IdentityHashMap(); for (int i = 0; i < 1000; i++) { map.put(new Integer(i), new Integer(i)); } Set set = map.keySet(); set.removeAll(set); assertEquals("did not remove all elements in the map", 0, map.size()); assertTrue("did not remove all elements in the keyset", set.isEmpty()); Iterator it = set.iterator(); assertTrue("keySet iterator still has elements", !it.hasNext()); }
79. DefaultPermissionsManagerImpl#hasPermission()
View licenseprivate boolean hasPermission(String role, String permission) { Collection realmList = new ArrayList(); realmList.add(getContextSiteId()); AuthzGroup authzGroup = null; try { authzGroup = authzGroupService.getAuthzGroup("!site.helper"); } catch (Exception e) { LOG.info("No site helper template found"); } if (authzGroup != null) { realmList.add(authzGroup.getId()); } Set allowedFunctions = authzGroupService.getAllowedFunctions(role, realmList); return allowedFunctions.contains(permission); }
80. UIPermissionsManagerImpl#getAreaItemsSet()
View licensepublic Set getAreaItemsSet(Area area) { if (ThreadLocalManager.get("message_center_permission_set") == null || !((Boolean) ThreadLocalManager.get("message_center_permission_set")).booleanValue()) { initMembershipForSite(); } Set allAreaSet = (Set) ThreadLocalManager.get("message_center_membership_area"); Set returnSet = new HashSet(); if (allAreaSet != null) { Iterator iter = allAreaSet.iterator(); while (iter.hasNext()) { DBMembershipItemImpl thisItem = (DBMembershipItemImpl) iter.next(); if (thisItem.getArea() != null && area.getId() != null && area.getId().equals(thisItem.getArea().getId())) { returnSet.add((DBMembershipItem) thisItem); } } } return returnSet; }
81. UIPermissionsManagerImpl#getForumItemsSet()
View licensepublic Set getForumItemsSet(DiscussionForum forum) { if (ThreadLocalManager.get("message_center_permission_set") == null || !((Boolean) ThreadLocalManager.get("message_center_permission_set")).booleanValue()) { initMembershipForSite(); } Set allForumSet = (Set) ThreadLocalManager.get("message_center_membership_forum"); Set returnSet = new HashSet(); Iterator iter = allForumSet.iterator(); while (iter.hasNext()) { DBMembershipItemImpl thisItem = (DBMembershipItemImpl) iter.next(); if (thisItem.getForum() != null && forum.getId() != null && forum.getId().equals(thisItem.getForum().getId())) { returnSet.add((DBMembershipItem) thisItem); } } return returnSet; }
82. UIPermissionsManagerImpl#getTopicItemsSet()
View licensepublic Set getTopicItemsSet(DiscussionTopic topic) { if (ThreadLocalManager.get("message_center_permission_set") == null || !((Boolean) ThreadLocalManager.get("message_center_permission_set")).booleanValue()) { initMembershipForSite(); } Set allTopicSet = (Set) ThreadLocalManager.get("message_center_membership_topic"); Set returnSet = new HashSet(); Iterator iter = allTopicSet.iterator(); while (iter.hasNext()) { DBMembershipItemImpl thisItem = (DBMembershipItemImpl) iter.next(); if (thisItem.getTopic() != null && topic.getId() != null && topic.getId().equals(thisItem.getTopic().getId())) { returnSet.add((DBMembershipItem) thisItem); } } return returnSet; }
83. SimpleDiff#buildEqSet()
View license/** * create a <code>Map</code> from each common item in orig and rev to the * index of its first occurrence in orig * * @param orig * the original sequence of items * @param rev * the revised sequence of items */ protected Map buildEqSet(Object[] orig, Object[] rev) { // construct a set of the objects that orig and rev have in common // first construct a set containing all the elements in orig Set items = new HashSet(Arrays.asList(orig)); // then remove all those not in rev items.retainAll(Arrays.asList(rev)); Map eqs = new HashMap(); for (int i = 0; i < orig.length; i++) { // if its a common item and hasn't been found before if (items.contains(orig[i])) { // add it to the map eqs.put(orig[i], Integer.valueOf(i)); // and make sure its not considered again items.remove(orig[i]); } } return eqs; }
84. ItemAddListener#preparePublishedTextForTF()
View licenseprivate void preparePublishedTextForTF(ItemFacade item, ItemBean bean) { Set answerSet = null; AnswerIfc answer = null; ItemTextIfc text = null; Set textSet = item.getItemTextSet(); Iterator iter = textSet.iterator(); while (iter.hasNext()) { text = (ItemTextIfc) iter.next(); text.setText(bean.getItemText()); answerSet = text.getAnswerSet(); Iterator answerIter = answerSet.iterator(); while (answerIter.hasNext()) { answer = (AnswerIfc) answerIter.next(); answer.setScore(Double.valueOf(bean.getItemScore())); answer.setDiscount(Double.valueOf(bean.getItemDiscount())); if (answer.getText().equals(bean.getCorrAnswer())) { answer.setIsCorrect(Boolean.TRUE); } else { answer.setIsCorrect(Boolean.FALSE); } } } }
85. ItemAddListener#preparePublishedTextForSurvey()
View licenseprivate void preparePublishedTextForSurvey(ItemFacade item, ItemBean bean, ItemService delegate) { String scalename = bean.getScaleName(); String[] choices = getSurveyChoices(scalename); Set answerSet = new HashSet(); Set textSet = item.getItemTextSet(); ItemTextIfc text = null; Iterator iter = textSet.iterator(); while (iter.hasNext()) { text = (ItemTextIfc) iter.next(); text.setText(bean.getItemText()); answerSet = text.getAnswerSet(); // For survey type, we erase all the existing ones. Because there is no benefit do update and then add/delete like FIB, FIN, or MC delegate.deleteSet(answerSet); for (int i = 0; i < choices.length; i++) { AnswerIfc answer = new PublishedAnswer(text, choices[i], Long.valueOf(i + 1), null, null, null, Double.valueOf(bean.getItemScore()), null, Double.valueOf(bean.getItemDiscount())); answerSet.add(answer); } text.setAnswerSet(answerSet); textSet.add(text); } }
86. GradingService#saveOrUpdateAssessmentGradingOnly()
View license// This API only touch SAM_ASSESSMENTGRADING_T. No data gets inserted/updated in SAM_ITEMGRADING_T public void saveOrUpdateAssessmentGradingOnly(AssessmentGradingData assessment) { Set origItemGradingSet = assessment.getItemGradingSet(); HashSet h = new HashSet(origItemGradingSet); // Clear the itemGradingSet so no data gets inserted/updated in SAM_ITEMGRADING_T; origItemGradingSet.clear(); int size = assessment.getItemGradingSet().size(); log.debug("before persist to db: size = " + size); try { PersistenceService.getInstance().getAssessmentGradingFacadeQueries().saveOrUpdateAssessmentGrading(assessment); } catch (Exception e) { log.error(e.getMessage(), e); } finally { // Restore the original itemGradingSet back assessment.setItemGradingSet(h); size = assessment.getItemGradingSet().size(); log.debug("after persist to db: size = {}", size); } }
87. SiteAction#getRolesAllowedToAttachSection()
View license// includeRole protected Set getRolesAllowedToAttachSection() { // Use !site.template.[site_type] String azgId = "!site.template.course"; AuthzGroup azgTemplate; try { azgTemplate = authzGroupService.getAuthzGroup(azgId); } catch (GroupNotDefinedException e) { M_log.error(this + ".getRolesAllowedToAttachSection: Could not find authz group " + azgId, e); return new HashSet(); } Set roles = azgTemplate.getRolesIsAllowed("site.upd"); roles.addAll(azgTemplate.getRolesIsAllowed("realm.upd")); return roles; }
88. CtClassType#makeUniqueName()
View licensepublic String makeUniqueName(String prefix) { HashMap table = new HashMap(); makeMemberList(table); Set keys = table.keySet(); String[] methods = new String[keys.size()]; keys.toArray(methods); if (notFindInArray(prefix, methods)) return prefix; int i = 100; String name; do { if (i > 999) throw new RuntimeException("too many unique name"); name = prefix + i++; } while (!notFindInArray(name, methods)); return name; }
89. DataCollectorBase#findPropertiesFromSystem()
View license// // Map System properties to ORB properties. // Security bug fix 4278205: // Only allow reading of system properties with ORB prefixes. // Previously a malicious subclass was able to read ANY system property. // Note that other prefixes are fine in other contexts; it is only // system properties that should impose a restriction. protected void findPropertiesFromSystem() { Set normalNames = getCORBAPrefixes(propertyNames); Set prefixNames = getCORBAPrefixes(propertyPrefixes); PropertyCallback callback = new PropertyCallback() { public String get(String name) { return getSystemProperty(name); } }; findPropertiesByName(normalNames.iterator(), callback); findPropertiesByPrefix(prefixNames, getSystemPropertyNames(), callback); }
90. PresentationManagerImpl#makeTypeIds()
View licenseprivate String[] makeTypeIds(NodeImpl root, Graph gr, Set rootSet) { Set nonRootSet = new HashSet(gr); nonRootSet.removeAll(rootSet); // List<String> for the typeids List result = new ArrayList(); if (rootSet.size() > 1) { // If the rootSet has more than one element, we must // put the type id of the implementation class first. // Root represents the implementation class here. result.add(root.getTypeId()); } addNodes(result, rootSet); addNodes(result, nonRootSet); return (String[]) result.toArray(new String[result.size()]); }
91. EqualsTest#main()
View licensepublic static void main(String[] args) { boolean test; /* synchronizedList test */ List list = Collections.synchronizedList(new ArrayList()); list.add(list); test = list.equals(list); assertTrue(test); list.remove(list); /* synchronizedSet test */ Set s = Collections.synchronizedSet(new HashSet()); s.add(s); test = s.equals(s); assertTrue(test); /* synchronizedMap test */ Map m = Collections.synchronizedMap(new HashMap()); test = m.equals(m); assertTrue(test); }
92. PreRegisterTest#main()
View licensepublic static void main(String[] args) throws Exception { System.out.println("Testing preRegister ObjectName substitution"); MBeanServer mbs = MBeanServerFactory.newMBeanServer(); mbs.createMBean(X.class.getName(), oldName); Set names = mbs.queryNames(null, null); System.out.println("MBean names after createMBean: " + names); boolean ok = true; if (names.contains(oldName)) { ok = false; System.out.println("TEST FAILS: previous name was used"); } if (!names.contains(newName)) { ok = false; System.out.println("TEST FAILS: substitute name was not used"); } if (ok) { System.out.println("Test passes: ObjectName correctly " + "substituted"); } else { System.out.println("TEST FAILS: ObjectName not correctly " + "substituted"); System.exit(1); } }
93. Synch3#main()
View licensepublic static void main(String[] args) { Subject subject = new Subject(); final Set principals = subject.getPrincipals(); principals.add(new X500Principal("CN=Alice")); new Thread() { { start(); } public void run() { X500Principal p = new X500Principal("CN=Bob"); while (!finished) { principals.add(p); principals.remove(p); } } }; for (int i = 0; i < 1000; i++) { subject.getPrincipals(X500Principal.class); } finished = true; }
94. ReflectUtils#getPropertyMethods()
View licensepublic static Method[] getPropertyMethods(PropertyDescriptor[] properties, boolean read, boolean write) { Set methods = new HashSet(); for (int i = 0; i < properties.length; i++) { PropertyDescriptor pd = properties[i]; if (read) { methods.add(pd.getReadMethod()); } if (write) { methods.add(pd.getWriteMethod()); } } methods.remove(null); return (Method[]) methods.toArray(new Method[methods.size()]); }
95. DumpStruct#call()
View licensepublic static Struct call(PageContext pc, Object object, double maxLevel, String show, String hide, double keys, boolean metainfo, boolean showUDFs, String label) { if (show != null && "all".equalsIgnoreCase(show.trim())) show = null; if (hide != null && "all".equalsIgnoreCase(hide.trim())) hide = null; Set setShow = (show != null) ? ListUtil.listToSet(show.toLowerCase(), ",", true) : null; Set setHide = (hide != null) ? ListUtil.listToSet(hide.toLowerCase(), ",", true) : null; DumpProperties properties = new DumpProperties((int) maxLevel, setShow, setHide, (int) keys, metainfo, showUDFs); DumpData dd = DumpUtil.toDumpData(object, pc, (int) maxLevel, properties); if (!StringUtil.isEmpty(label)) { DumpTable table = new DumpTable("#ffffff", "#cccccc", "#000000"); table.appendRow(1, new SimpleDumpData(label)); table.appendRow(0, dd); dd = table; } RefBoolean hasReference = new RefBooleanImpl(false); Struct sct = toStruct(dd, object, hasReference); sct.setEL("hasReference", hasReference.toBoolean()); return sct; }
96. NameMappings#addLookupOnly()
View licensepublic void addLookupOnly(String namespaceURI, String cls) { Set classes = lookupOnly.get(namespaceURI); if (classes == null) { classes = new HashSet<String>(); lookupOnly.put(namespaceURI, classes); } classes.add(cls); }
97. SectionManagerImpl#getTotalEnrollments()
View license/** * {@inheritDoc} */ public int getTotalEnrollments(String learningContextUuid) { Group group = findGroup(learningContextUuid); if (group == null) { log.error("learning context " + learningContextUuid + " not found"); return 0; } Set users = group.getUsersIsAllowed(SectionAwareness.STUDENT_MARKER); return users.size(); }
98. CmSynchronizer#reconcileEnrollments()
View licenseprotected void reconcileEnrollments(Element enrollmentsElement, EnrollmentSet enrollmentSet) { List newEnrollmentElements = enrollmentsElement.getChildren("enrollment"); Set newUserEids = new HashSet(); Set existingEnrollments = cmService.getEnrollments(enrollmentSet.getEid()); for (Iterator iter = newEnrollmentElements.iterator(); iter.hasNext(); ) { Element enrollmentElement = (Element) iter.next(); String userEid = enrollmentElement.getChildText("userEid"); newUserEids.add(userEid); String status = enrollmentElement.getChildText("status"); String credits = enrollmentElement.getChildText("credits"); String gradingScheme = enrollmentElement.getChildText("grading-scheme"); cmAdmin.addOrUpdateEnrollment(userEid, enrollmentSet.getEid(), status, credits, gradingScheme); } for (Iterator iter = existingEnrollments.iterator(); iter.hasNext(); ) { Enrollment existingEnr = (Enrollment) iter.next(); if (!newUserEids.contains(existingEnr.getUserId())) { // Drop this enrollment cmAdmin.removeEnrollment(existingEnr.getUserId(), enrollmentSet.getEid()); } } }
99. CourseManagementAdministrationHibernateImpl#removeCourseOfferingFromCourseSet()
View licensepublic boolean removeCourseOfferingFromCourseSet(String courseSetEid, String courseOfferingEid) { CourseSetCmImpl courseSet = (CourseSetCmImpl) getObjectByEid(courseSetEid, CourseSetCmImpl.class.getName()); CourseOffering courseOffering = (CourseOffering) getObjectByEid(courseOfferingEid, CourseOfferingCmImpl.class.getName()); Set offerings = courseSet.getCourseOfferings(); if (offerings == null || !offerings.contains(courseOffering)) { return false; } offerings.remove(courseOffering); courseSet.setLastModifiedBy(authn.getUserEid()); courseSet.setLastModifiedDate(new Date()); getHibernateTemplate().update(courseSet); return true; }
100. IvyMenuContributionItem#doCollectContainer()
View licenseprivate void doCollectContainer(Map /* <IProject, Set<IvyClasspathContainer>> */ containers, IvyClasspathContainerImpl ivycp) { IJavaProject javaProject = ivycp.getConf().getJavaProject(); if (javaProject == null) { return; } Set /* <IvyClasspathContainer> */ cplist = (Set) containers.get(javaProject.getProject()); if (cplist == null) { cplist = new HashSet(); containers.put(javaProject.getProject(), cplist); } cplist.add(ivycp); }