title: Interface where one class does not implement method
body: <p>I have producers that takes data A ,produce data B and send it</p>
  <pre><code>    public interface Producer&lt;T&gt;{
          void produce(T data);
          void flush();
      }
  
      public class DataBaseProducer implements Producer&lt;String&gt;{
          List&lt;String&gt; producedData = new ArrayList&lt;&gt;();
  
          // create data
          public void produce(String data){
              producedData.add(transformData(data));
          }
  
         // send created data
          public void flush(){
             sendDataToDatabase(producedData);
          }
      }
  
     
     public class MessageProducer implements Producer&lt;String&gt;{
          public void produce(String data){
             String line =transformData(data)
             sendDataToMessageQueue(line);
          }
  
          public void flush(){
          }
     }
  
  public static void main(String[] args) {
      // get producer
      Producer producer = getProducer(producerName)
      BufferedReader reader;
      try {
          reader = new BufferedReader(new FileReader(file..));
          String line = reader.readLine();
          while (line != null) {
              producer.produce(line)
              line = reader.readLine();
          }
          reader.close();
          producer.flush()
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  <p>To demonstrate my question, imagine i have producers like above. One loads all data, and then bulk send it at once after it done, and second sends data right away ( so it does not bulk send data, but whenever new data is createdit sends it right away)</p>
  <p>Most of the producers will send the data after every data is loaded, but few of them will send them right away. If the producer sends data right away, than the <code>flush()</code> method remains empty. This however seems like bad pratcise and may violates some OOP principles. What is the correct way to implement this?</p>
  <p>Thanks for answers!</p>