Is there an alternative to hyper-indented code?
问题 I often run into code that has to perform lots of checks and ends up being indented at least five or six levels before really doing anything. I am wondering what alternatives exist. Below I've posted an example of what I'm talking about (which isn't actual production code, just something I came up with off the top of my head). public String myFunc(SomeClass input) { Object output = null; if(input != null) { SomeClass2 obj2 = input.getSomeClass2(); if(obj2 != null) { SomeClass3 obj3 = obj2