What does return do when used inside an if statement?

后端 未结 8 1628
醉梦人生
醉梦人生 2020-12-31 02:16

What does the return inside the if statements do in the following code?

public void startElement(String namespaceURI, String localName,String qName, 
               


        
8条回答
  •  孤独总比滥情好
    2020-12-31 02:36

    The return here is probably used in order to "improve" the performance of the method, so that other comparisons are not executed, once the needed scenario is performed.

    However, it's not good practice to have multiple return points in a method.

    As stated in my comments I'd try a different approach to achieve the flow of the code in question.

提交回复
热议问题