title: How can I reduce the Cyclomatic Complexity of this?
body: <p>I have a method that receives an Object and does something based on what type of object it detects:</p>
  
  <pre><code>void receive(Object object) {
      if (object instanceof ObjectTypeA) {
          doSomethingA();
      }
      else {
          if (object instanceof ObjectTypeB) {
              doSomethingB();
          }
          else {
              if (object instanceof ObjectTypeC) {
                  doSomethingC();
              }
              else {
                  if (object instanceof ObjectTypeD) {
                      doSomethingD();
                  }
                  else {
                      // etc...
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>How can I reduce the Cyclomatic Complexity? I searched around but couldn't find anything too useful.</p>