偶然看到某知名支付里面的源码,感觉写得非常的蛋疼,所以就贴出来,并且我想改进一下这个代码。
public boolean checkArgs() {
if (this.appId != null && this.appId.length() != 0) {
if (this.partnerId != null && this.partnerId.length() != 0) {
if (this.prepayId != null && this.prepayId.length() != 0) {
if (this.nonceStr != null && this.nonceStr.length() != 0) {
if (this.timeStamp != null && this.timeStamp.length() != 0) {
if (this.packageValue != null && this.packageValue.length() != 0) {

本文分享了对某知名支付平台SDK源码的观察,指出原始代码存在的问题,并提供了使用箭头函数进行优化后的代码示例,确保逻辑正确性。


被折叠的 条评论
为什么被折叠?



