class DAFileWriter implements DAWriter {

  public DAFileWriter appendImports(@Nonnull Collection<DAImport> mapperImports) throws IOException {
    checkNotNull(mapperImports, "Collection of imports can not be null");

    if (mapperImports.isEmpty()) {
      return this;
    }

    List<DAName> imports = removeDuplicatesFilterJavaLangAndSortImports(mapperImports);
    if (imports.isEmpty()) {
      this.importQualifiedNames = Collections.emptySet();
      this.importSimpleNames = Collections.emptySet();
      return this;
    }

    this.importQualifiedNames = from(mapperImports)
        .transform(DAImportFunctions.toQualifiedName())
        .filter(notNull())
        .toSet();
    this.importSimpleNames = from(mapperImports).transform(DAImportFunctions.toSimpleName())
        .filter(notNull())
        .toSet();

    for (DAName name : imports) {
      writer.append("import ").append(name).append(";");
      writer.newLine();
    }
    writer.newLine();
    return this;
  }

  public  DAFileWriter(BufferedWriter writer);

}