public static String removeDhAnonFromCommaSeparatedList(String list){
  if (list == null) {
    return list;
  }
  List<String> algorithms=new LinkedList<String>(Arrays.asList(list.split("\\s*,\\s*")));
  boolean dhAnonRemoved=algorithms.remove("DH_anon");
  boolean ecdhAnonRemoved=algorithms.remove("ECDH_anon");
  if (dhAnonRemoved || ecdhAnonRemoved) {
    String string=Arrays.toString(algorithms.toArray(new String[algorithms.size()]));
    return (algorithms.size() > 0) ? string.substring(1,string.length() - 1) : "";
  }
  return list;
}

public static String removeDhAnonFromCommaSeparatedList ( String list ) { if ( list == null ) { return list ; } List < String > algorithms = new LinkedList < String > ( Arrays . asList ( list . split ( "\\s*,\\s*" ) ) ) ; boolean dhAnonRemoved = algorithms . remove ( "DH_anon" ) ; boolean ecdhAnonRemoved = algorithms . remove ( "ECDH_anon" ) ; if ( dhAnonRemoved || ecdhAnonRemoved ) { String string = Arrays . toString ( algorithms . toArray ( new String [ algorithms . size ( ) ] ) ) ; return ( algorithms . size ( ) > 0 ) ? string . substring ( 1 , string . length ( ) - 1 ) : "" ; } return list ; }
removes dh_anon and ecdh_anon from a comma separated list of ciphers . only the first occurrence is removed . if there is nothing to remove , returns the reference to the argument .
