title: Throwing an UnsupportedOperationException
body: <p>So one of the method descriptions goes as follows: </p>
  
  <blockquote>
    <p>public BasicLinkedList addToFront(T data) This operation is invalid
    for a sorted list. An UnsupportedOperationException will be generated
    using the message "Invalid operation for sorted list."</p>
  </blockquote>
  
  <p>My code goes something like this:</p>
  
  <pre><code>public BasicLinkedList&lt;T&gt; addToFront(T data) {
      try {
          throw new UnsupportedOperationException("Invalid operation for sorted list.");
      } catch (java.lang.UnsupportedOperationException e) {
          System.out.println("Invalid operation for sorted list.");
      }
      return this;
  }
  </code></pre>
  
  <p>Is this the right way of doing this? I just printed out the message using <code>println()</code> but is there a different way to generate the message?</p>