001package edu.pdx.cs410J.airlineweb; 002 003import java.io.PrintWriter; 004import java.io.Writer; 005import java.util.Map; 006 007public class TextDumper { 008 private final Writer writer; 009 010 public TextDumper(Writer writer) { 011 this.writer = writer; 012 } 013 014 public void dump(Map<String, String> dictionary) { 015 try ( 016 PrintWriter pw = new PrintWriter(this.writer) 017 ){ 018 for (Map.Entry<String, String> entry : dictionary.entrySet()) { 019 pw.println(entry.getKey() + " : " + entry.getValue()); 020 } 021 022 pw.flush(); 023 } 024 } 025}