public static Set combineOCs(Set one,Set two){
  if (one == null || one.isEmpty()) {
    return two;
  }
  if (two == null || two.isEmpty()) {
    return one;
  }
  Set resultSet=new HashSet();
  Iterator itr1=one.iterator();
  while (itr1.hasNext()) {
    String value1=(String)itr1.next();
    resultSet.add(value1.toLowerCase());
  }
  Iterator itr2=two.iterator();
  while (itr2.hasNext()) {
    String value2=(String)itr2.next();
    resultSet.add(value2.toLowerCase());
  }
  return resultSet;
}

public static Set combineOCs ( Set one , Set two ) { if ( one == null || one . isEmpty ( ) ) { return two ; } if ( two == null || two . isEmpty ( ) ) { return one ; } Set resultSet = new HashSet ( ) ; Iterator itr1 = one . iterator ( ) ; while ( itr1 . hasNext ( ) ) { String value1 = ( String ) itr1 . next ( ) ; resultSet . add ( value1 . toLowerCase ( ) ) ; } Iterator itr2 = two . iterator ( ) ; while ( itr2 . hasNext ( ) ) { String value2 = ( String ) itr2 . next ( ) ; resultSet . add ( value2 . toLowerCase ( ) ) ; } return resultSet ; }
combines two sets which contains objectclass values of an entry in a case insensitive manner . oc values are sometimes returned by ldap in mixed case and when duplicate values for objectclass exists in a mixed case , there is a object class violation note : there is a possibility that this method will return null
