标签:内联函数 after more 去除 nbsp span bool live boolean
意图
- 内部代码和函数名称同样清晰易读,去除无用的间接层
示例
/** * 内联函数之前 * Created by luo on 2017/4/18. */ public class InlineMethodBefore { private Integer _numberOfLateDeliveries ; int getRating(){ return (moreThanFiveLateDliveries()) ? 2 : 1; } private boolean moreThanFiveLateDliveries() { return _numberOfLateDeliveries > 5; } } /** * 内联函数之后 * Created by luo on 2017/4/18. */ public class InlineMethodAfter { private Integer _numberOfLateDeliveries ; int getRating(){ return (_numberOfLateDeliveries > 5) ? 2 : 1; } }
标签:内联函数 after more 去除 nbsp span bool live boolean
原文地址:http://www.cnblogs.com/luoxiaolei/p/6759102.html