public AccessControlContext(ProtectionDomain context[]){
  if (context.length == 0) {
    this.context=null;
  }
 else   if (context.length == 1) {
    if (context[0] != null) {
      this.context=context.clone();
    }
 else {
      this.context=null;
    }
  }
 else {
    List<ProtectionDomain> v=new ArrayList<>(context.length);
    for (int i=0; i < context.length; i++) {
      if ((context[i] != null) && (!v.contains(context[i])))       v.add(context[i]);
    }
    if (!v.isEmpty()) {
      this.context=new ProtectionDomain[v.size()];
      this.context=v.toArray(this.context);
    }
  }
}

public AccessControlContext ( ProtectionDomain context [ ] ) { if ( context . length == 0 ) { this . context = null ; } else if ( context . length == 1 ) { if ( context [ 0 ] != null ) { this . context = context . clone ( ) ; } else { this . context = null ; } } else { List < ProtectionDomain > v = new ArrayList < > ( context . length ) ; for ( int i = 0 ; i < context . length ; i ++ ) { if ( ( context [ i ] != null ) && ( ! v . contains ( context [ i ] ) ) ) v . add ( context [ i ] ) ; } if ( ! v . isEmpty ( ) ) { this . context = new ProtectionDomain [ v . size ( ) ] ; this . context = v . toArray ( this . context ) ; } } }
create an accesscontrolcontext with the given array of protectiondomains . context must not be null . duplicate domains will be removed from the context .
