title: How should exceptions be handled in case of wrapper class?
body: <p>Suppose we have a class Graph and another class called GraphWrapper.
  Graph class has a method called returnAdjVertices.</p>
  
  <pre><code>public List returnAdjVertices(int vertex) {
      if (vertex &lt; 0 || vertex &gt;= maxVertexCount) {
          throw exception
      }
  }
  </code></pre>
  
  <p>Now we have a wrapper function in GraphWrapper which would calculate degree of a vertex</p>
  
  <pre><code>public static int getDegree(Graph graph, int vertex) {
      if (graph == null) throw new NullPointerException();
      if (vertext &lt; 0 || vertex &gt;= graph.maxVertexCount) throw exception // REDUNDANT
  
      return graph.returnAdjVertices(vertex).size();
  }
  </code></pre>
  
  <p>Now a call to find degree is checking for vertex bound condition twice.</p>
  
  <p>This means we are doing a redundant check. What is the best practice recommended for exception handling in such a case ?</p>