/**
  * sets the java certstore to this extended pkix parameters.
  *
  * @throws classcastexception if an element of <code>stores</code> is not a <code>certstore</code>
  *     .
  */
 public void setcertstores(list stores) {
   if (stores != null) {
     iterator it = stores.iterator();
     while (it.hasnext()) {
       addcertstore((certstore) it.next());
     }
   }
 }
 /**
  * sets the attribute certificates which are not allowed.
  *
  * <p>the <code>set</code> must contain <code>string</code>s with the oids.
  *
  * <p>the set is cloned.
  *
  * @param prohibitedacattributes the prohibited ac attributes to set.
  * @throws classcastexception if an element of <code>prohibitedacattributes</code> is not a <code>
  *     string</code>.
  */
 public void setprohibitedacattributes(set prohibitedacattributes) {
   if (prohibitedacattributes == null) {
     this.prohibitedacattributes.clear();
     return;
   }
   for (iterator it = prohibitedacattributes.iterator(); it.hasnext(); ) {
     if (!(it.next() instanceof string)) {
       throw new classcastexception("all elements of set must be " + "of type string.");
     }
   }
   this.prohibitedacattributes.clear();
   this.prohibitedacattributes.addall(prohibitedacattributes);
 }
 /**
  * sets the bouncy castle stores for finding crls, certificates, attribute certificates or cross
  * certificates.
  *
  * <p>the <code>list</code> is cloned.
  *
  * @param stores a list of stores to use.
  * @see #getstores
  * @throws classcastexception if an element of <code>stores</code> is not a {@link store}.
  */
 public void setstores(list stores) {
   if (stores == null) {
     this.stores = new arraylist();
   } else {
     for (iterator i = stores.iterator(); i.hasnext(); ) {
       if (!(i.next() instanceof store)) {
         throw new classcastexception(
             "all elements of list must be " + "of type org.bouncycastle.util.store.");
       }
     }
     this.stores = new arraylist(stores);
   }
 }
 /**
  * sets the trusted attribute certificate issuers. if attribute certificates is verified the
  * trusted ac issuers must be set.
  *
  * <p>the <code>trustedacissuers</code> must be a <code>set</code> of <code>trustanchor</code>
  *
  * <p>the given set is cloned.
  *
  * @param trustedacissuers the trusted ac issuers to set. is never <code>null</code>.
  * @throws classcastexception if an element of <code>stores</code> is not a <code>trustanchor
  *     </code>.
  */
 public void settrustedacissuers(set trustedacissuers) {
   if (trustedacissuers == null) {
     this.trustedacissuers.clear();
     return;
   }
   for (iterator it = trustedacissuers.iterator(); it.hasnext(); ) {
     if (!(it.next() instanceof trustanchor)) {
       throw new classcastexception(
           "all elements of set must be " + "of type " + trustanchor.class.getname() + ".");
     }
   }
   this.trustedacissuers.clear();
   this.trustedacissuers.addall(trustedacissuers);
 }
 /**
  * sets the attribute certificate checkers.
  *
  * <p>all elements in the <code>set</code> must a {@link pkixattrcertchecker}.
  *
  * <p>the given set is cloned.
  *
  * @param attrcertcheckers the attribute certificate checkers to set. is never <code>null</code>.
  * @throws classcastexception if an element of <code>attrcertcheckers</code> is not a <code>
  *     pkixattrcertchecker</code>.
  */
 public void setattrcertcheckers(set attrcertcheckers) {
   if (attrcertcheckers == null) {
     this.attrcertcheckers.clear();
     return;
   }
   for (iterator it = attrcertcheckers.iterator(); it.hasnext(); ) {
     if (!(it.next() instanceof pkixattrcertchecker)) {
       throw new classcastexception(
           "all elements of set must be "
               + "of type "
               + pkixattrcertchecker.class.getname()
               + ".");
     }
   }
   this.attrcertcheckers.clear();
   this.attrcertcheckers.addall(attrcertcheckers);
 }
  public void testmakeimmutable() {
    smallsortedmap<integer, integer> map = smallsortedmap.newinstancefortest(3);
    for (int i = 0; i < 6; i++) {
      assertnull(map.put(i, i + 1));
    }
    map.makeimmutable();
    assertequals(new integer(1), map.get(0));
    assertequals(6, map.size());

    try {
      map.put(23, 23);
      fail("expected unsupportedoperationexception");
    } catch (unsupportedoperationexception expected) {
    }

    map<integer, integer> other = new hashmap<integer, integer>();
    other.put(23, 23);
    try {
      map.putall(other);
      fail("expected unsupportedoperationexception");
    } catch (unsupportedoperationexception expected) {
    }

    try {
      map.remove(0);
      fail("expected unsupportedoperationexception");
    } catch (unsupportedoperationexception expected) {
    }

    try {
      map.clear();
      fail("expected unsupportedoperationexception");
    } catch (unsupportedoperationexception expected) {
    }

    set<map.entry<integer, integer>> entryset = map.entryset();
    try {
      entryset.clear();
      fail("expected unsupportedoperationexception");
    } catch (unsupportedoperationexception expected) {
    }

    iterator<map.entry<integer, integer>> it = entryset.iterator();
    while (it.hasnext()) {
      map.entry<integer, integer> entry = it.next();
      try {
        entry.setvalue(0);
        fail("expected unsupportedoperationexception");
      } catch (unsupportedoperationexception expected) {
      }
      try {
        it.remove();
        fail("expected unsupportedoperationexception");
      } catch (unsupportedoperationexception expected) {
      }
    }

    set<integer> keyset = map.keyset();
    try {
      keyset.clear();
      fail("expected unsupportedoperationexception");
    } catch (unsupportedoperationexception expected) {
    }

    iterator<integer> keys = keyset.iterator();
    while (keys.hasnext()) {
      integer key = keys.next();
      try {
        keyset.remove(key);
        fail("expected unsupportedoperationexception");
      } catch (unsupportedoperationexception expected) {
      }
      try {
        keys.remove();
        fail("expected unsupportedoperationexception");
      } catch (unsupportedoperationexception expected) {
      }
    }
  }