code: public JavaWriter emitImports(Collection<String> types) throws IOException {
      for (String type : new TreeSet<String>(types)) {
        Matcher matcher = TYPE_PATTERN.matcher(type);
        if (!matcher.matches()) {
          throw new IllegalArgumentException(type);
        }
        if (importedTypes.put(type, matcher.group(1)) != null) {
          throw new IllegalArgumentException(type);
        }
        out.write("import ");
        out.write(type);
        out.write(";\n");
      }
      return this;
    }
docs: Emit an import for each {@code type} in the provided {@code Collection}. For the duration of
  the file, all references to these classes will be automatically shortened.