title: Compare the OutputStream of a Socket with a DataOutputStream
body: <p>I have a bunch of <code>DataOutputStream</code>s in <code>Hashtable outputStreams;</code>. There is a <code>Socket</code> for each of them. I want to loop through them but I want to exclude one particular <code>Socket</code>. I've been trying with the following algorithm but it doesn't seem to work.</p>
  
  <pre><code>for(Enumeration e = outputStreams.elements(); e.hasMoreElements(); ) {
  
      DataOutputStream dout = (DataOutputStream)e.nextElement();
      OutputStream sdout = null;
      try {
          sdout = socket.getOutputStream();
      } catch (IOException ie) {
          ie.printStackTrace();
      }
  
      if (dout != sdout) {
          try {
              dout.writeUTF(message);
          } catch (IOException ie) {
              ie.printStackTrace();
          }
      }
  }
  </code></pre>