Package java.util

Examples of java.util.Set.retainAll()


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


      map.put(new Integer(i), new Integer(i));
    }
    Set set = map.keySet();

    // retain all the elements
    boolean result = set.retainAll(set);
    assertTrue("retain all should return false", !result);
    assertEquals("did not retain all", 1000, set.size());

    // send empty set to retainAll
    result = set.retainAll(new TreeSet());
View Full Code Here

    boolean result = set.retainAll(set);
    assertTrue("retain all should return false", !result);
    assertEquals("did not retain all", 1000, set.size());

    // send empty set to retainAll
    result = set.retainAll(new TreeSet());
    assertTrue("retain all should return true", result);
    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();
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

                if (!acls.contains(GroupPrincipal.ANY)) {
                    Subject subject = exchange.getMessage("in").getSecuritySubject();
                    if (subject == null) {
                        throw new SecurityException("User not authenticated");
                    }
                    acls.retainAll(subject.getPrincipals());
                    if (acls.size() == 0) {
                        throw new SecurityException("Endpoint is not authorized for this user");
                    }
                }
            }
View Full Code Here

      map.put(new Integer(i), new Integer(i));
    }
    Set set = map.keySet();

    // retain all the elements
    boolean result = set.retainAll(set);
    assertTrue("retain all should return false", !result);
    assertEquals("did not retain all", 1000, set.size());

    // send empty set to retainAll
    result = set.retainAll(new TreeSet());
View Full Code Here

    boolean result = set.retainAll(set);
    assertTrue("retain all should return false", !result);
    assertEquals("did not retain all", 1000, set.size());

    // send empty set to retainAll
    result = set.retainAll(new TreeSet());
    assertTrue("retain all should return true", result);
    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();
View Full Code Here

                                                FontRenderContext frc) {

        Set keys = aci.getAllAttributeKeys();
        Set glyphPositionKeys = new HashSet();
        glyphPositionKeys.add(TextAttribute.BIDI_EMBEDDING);
        glyphPositionKeys.retainAll(keys);

        if (glyphPositionKeys.isEmpty() ||
            (aci.getAttribute(TextAttribute.RUN_DIRECTION) ==
       TextAttribute.RUN_DIRECTION_RTL)) {
            return new TextLayoutAdapter(new TextLayout(aci, frc), offset, aci);
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

  public static String[] getDifference(String oldValue, String newValue) {
    Set oldSet= deserialize(oldValue);
    Set newSet= deserialize(newValue);
    Set intersection= new HashSet(oldSet);
    intersection.retainAll(newSet);
    oldSet.removeAll(intersection);
    newSet.removeAll(intersection);
    oldSet.addAll(newSet);
    return (String[]) oldSet.toArray(new String[oldSet.size()]);
  }
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.