title: How to Use OOP effectively to implement Interfaces for displaying different Output formats
body: <p>I have to implement an output display module in a java application. It has three output formats, HTML, CSV and .txt.</p>
  <p><strong>The input formats are of 2 types:</strong> either <code>ArrayList</code> or <code>HashMap</code>.</p>
  <p>I have to implement this using OOPS effectively and defining interfaces for each type of output functionality. I want to know if there is a better way to implement this.</p>
  <p><strong>The pseudo code for what I have tried so far is:</strong></p>
  <pre><code>OutputDisplayInterface 
  {
  
   public void TextDisplay();
   public void CSVDisplay();
   public void HTMLDisplay();
  }
  
  TextDisplayInterface
  {
  public void maptotext();
  public void listtotext();
  }
  TextDisplayClass implements TextDisplayInterface{
    \\method implementations
  }
  CSVDisplayInterface
  {
   public void maptocsv();
   public void arraylisttocsv();
  
  }
   CSVDisplayClass implements CSVDisplayInterface{
    \\method implementations
  }
  HTMLDisplayInterface
  {
  public void maptoHTML();
  public void arraylisttoHTML();
  
  }
  HTMLDisplayClass implements HTMLDisplayInterface{
    \\method implementations
  }
  OutputDisplayClass implements OutputDisplayInterface
  {
   public void TextDisplay(){
   TextDisplay t = new TextDisplayClass();
   t.maptotext();
   t.listtotext();
  
  }
  
  public void CSVDisplay(){
  CSVDisplay t = new TextDisplayClass();
  t.maptocsv();
  t.listtocsv();
  
  }
   ....
  }
  </code></pre>
  <p>If I call <code>TextDisplay()</code> in the main function, both the methods <code>maptotext()</code> and <code>listtotext()</code> will be called, when in fact I want only one of them to execute as per the input data type(i.e  <code>hashmap</code> or a <code>list</code>) .</p>