title: Format a Date, allowing null
body: <p>I'm trying to print a <code>Date</code>, just the way <a href="http://download.oracle.com/javase/6/docs/api/java/text/DateFormat.html#getDateTimeInstance%28%29" rel="noreferrer"><code>DateFormat.getDateTimeInstance()</code></a> does it.</p>
  
  <p><code>format</code> throws a <code>NullPointerException</code> when passing <code>null</code>, so I've been wondering if there is a different approach that would return <code>null</code> (or <code>"null"</code>) instead?</p>
  
  <p>Something I'd call instead of</p>
  
  <pre><code>Date d = null;
  System.out.println(d==null ? null : DateFormat.getDateTimeInstance().format(d));
  </code></pre>