private static Class[] reduce0(Class[] classes,boolean keepSupers){
  if (classes.length == 0) {
    throw new IllegalArgumentException("cannot create constraint with no elements");
  }
  int i=0;
  outer:   for (int j=0; j < classes.length; j++) {
    Class cj=classes[j];
    verify(cj);
    for (int k=i; --k >= 0; ) {
      Class ck=classes[k];
      if (keepSupers ? ck.isAssignableFrom(cj) : cj.isAssignableFrom(ck)) {
        continue outer;
      }
      if (keepSupers ? cj.isAssignableFrom(ck) : ck.isAssignableFrom(cj)) {
        classes[k]=classes[--i];
      }
    }
    classes[i++]=cj;
  }
  return (Class[])trim(classes,i);
}

private static Class [ ] reduce0 ( Class [ ] classes , boolean keepSupers ) { if ( classes . length == 0 ) { throw new IllegalArgumentException ( "cannot create constraint with no elements" ) ; } int i = 0 ; outer : for ( int j = 0 ; j < classes . length ; j ++ ) { Class cj = classes [ j ] ; verify ( cj ) ; for ( int k = i ; -- k >= 0 ; ) { Class ck = classes [ k ] ; if ( keepSupers ? ck . isAssignableFrom ( cj ) : cj . isAssignableFrom ( ck ) ) { continue outer ; } if ( keepSupers ? cj . isAssignableFrom ( ck ) : ck . isAssignableFrom ( cj ) ) { classes [ k ] = classes [ -- i ] ; } } classes [ i ++ ] = cj ; } return ( Class [ ] ) trim ( classes , i ) ; }
verifies that there is at least one element , and returns an array of the elements , in arbitrary order , with redundant classes removed as follows . for any two classes c1 and c2 , if c1 . isassignablefrom ( c2 ) is true , then c2 is removed if keepsupers is true , otherwise c1 is removed . the array argument may be modified . if no classes need to be removed , the array argument may be returned . note # 1 : here we ' re removing ck , and we close the gap by moving the last already - processed element ( common [ i - 1 ] ) down to replace it . we don ' t need to arraycopy all of the elements down because order doesn ' t matter . in the degenerate case ( k = = i - 1 ) we copy an element onto itself , but that does no harm .
