public static Set<String> toSet(String s){
  Set<String> newSet=new HashSet<String>();
  if (s.startsWith("[") && s.endsWith("]")) {
    s=s.substring(1,s.length() - 1);
    String[] entries=s.split("\\,\\s");
    for (    String entry : entries) {
      newSet.add(entry);
    }
  }
 else {
    throw new IllegalArgumentException("String is not from Set.toString()");
  }
  return newSet;
}

public static Set < String > toSet ( String s ) { Set < String > newSet = new HashSet < String > ( ) ; if ( s . startsWith ( "[" ) && s . endsWith ( "]" ) ) { s = s . substring ( 1 , s . length ( ) - 1 ) ; String [ ] entries = s . split ( "\\,\\s" ) ; for ( String entry : entries ) { newSet . add ( entry ) ; } } else { throw new IllegalArgumentException ( "String is not from Set.toString()" ) ; } return newSet ; }
reads a string version of a set ( should contain only strings ) and creates a new set
