Package java.util

Examples of java.util.Set.retainAll()


        // We never get to this point if buxfixed is true and any of these stands:
        // - One of classes was a primitive type
        // - One of classes was a numerical type (either boxing type or primitive)
       
        Set commonTypes = _MethodUtil.getAssignables(c1, c2);
        commonTypes.retainAll(_MethodUtil.getAssignables(c2, c1));
        if(commonTypes.isEmpty()) {
            // Can happen when at least one of the arguments is an interface, as
            // they don't have Object at the root of their hierarchy
            return Object.class;
        }
View Full Code Here


    private static Method getCallbackMethod(Class cls) {
        // Look at only public methods defined by the Callback class
        Method[] pubMethods = cls.getDeclaredMethods();
        Method[] classMethods = cls.getMethods();
        Set pmethods = new HashSet(Arrays.asList(pubMethods));
        pmethods.retainAll(Arrays.asList(classMethods));

        // Remove Object methods disallowed as callback method names
        for (Iterator i=pmethods.iterator();i.hasNext();) {
            Method m = (Method)i.next();
            if (Callback.FORBIDDEN_NAMES.contains(m.getName())) {
View Full Code Here

  private Set knownEdit2(String word) {
    Set typos = new HashSet();
    for (Iterator itr = typos.iterator(); itr.hasNext();) {
      typos.addAll(edit1(word));
    }
    typos.retainAll(wordFrequency.keySet());
    return typos;
  }

  public static void main(String[] args) throws Exception {
    NaiveBayesianSpellChecker checker = new NaiveBayesianSpellChecker(
View Full Code Here

            for (int j = 0; j < intersected.length; j++) {
                Collection arts = getArtifactsIncludingExtending(intersected[j]);
                if (intersectedArtifacts.isEmpty()) {
                    intersectedArtifacts.addAll(arts);
                } else {
                    intersectedArtifacts.retainAll(arts);
                }
            }
            if (artifacts != null) {
                intersectedArtifacts.addAll(artifacts);
            }
View Full Code Here

        });
       
        storedUserChecked.addAll(newCheckedUsers);
       
        Set usersUnclicked = new HashSet(storedUserChecked);
        usersUnclicked.retainAll(usersShown);
        usersUnclicked.removeAll(newCheckedUsers);
        storedUserChecked.removeAll(usersUnclicked);
    }

    private User[] searchUsers(String request, Integer from, Integer howMany) {
View Full Code Here

            fail("Should have thrown UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            ; // Expected result
        }
        try {
            entrySet.retainAll(mapEntries);
            fail("Should have thrown UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            ; // Expected result
        }
View Full Code Here

            fail("Should have thrown UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            ; // Expected result
        }
        try {
            keySet.retainAll(mapKeys);
            fail("Should have thrown UnsupportedOperationException");
        } catch (UnsupportedOperationException e) {
            ; // Expected result
        }
View Full Code Here

            if ("key1".equals(entry.getKey())) {
                list.add(entry);
                break;
            }
        }
        assertTrue(entrySet.retainAll(list));
        assertTrue(sessionMap.size() == 1);
        sessionMap.clear();
        sessionMap.putAll(cloneMap);

        // next validate Iterator.remove goes through to the backing Map.
View Full Code Here

            if ("key1".equals(entry.getKey())) {
                list.add(entry);
                break;
            }
        }
        assertTrue(entrySet.retainAll(list));
        assertTrue(requestMap.size() == 1);
        requestMap.clear();
        requestMap.putAll(cloneMap);

        // next validate Iterator.remove goes through to the backing Map.
View Full Code Here

        entrySet = facets.entrySet();
        matches = new HashSet();
        matches.add(new TestMapEntry("b", facet2));
        matches.add(new TestMapEntry("d", facet4));
        matches.add(new TestMapEntry("f", facet6));
        entrySet.retainAll(matches);
        assertEquals(2, facets.size());
        assertEquals(2, entrySet.size());
        checkFacetMissing(component, "a", facet1);
        checkFacetPresent(component, "b", facet2);
        checkFacetMissing(component, "c", facet3);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.