title: Detecting if a method is declared in an interface in Java
body: <p>Help me make this method more solid:</p>
  
  <pre><code> /**
    * Check if the method is declared in the interface.
    * Assumes the method was obtained from a concrete class that 
    * implements the interface, and return true if the method overrides
    * a method from the interface.
    */
   public static boolean isDeclaredInInterface(Method method, Class&lt;?&gt; interfaceClass) {
       for (Method methodInInterface : interfaceClass.getMethods())
       {
           if (methodInInterface.getName().equals(method.getName()))
               return true;
       }
       return false;
   }
  </code></pre>