Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lang.length(obj) 调一次清爽些 #1153

Merged
merged 1 commit into from
Oct 21, 2016
Merged

Lang.length(obj) 调一次清爽些 #1153

merged 1 commit into from
Oct 21, 2016

Conversation

xing-kenny
Copy link
Contributor

    final EntityOperator opt = _optBy(Lang.first(obj));
    if (null == opt)
        return null;
    int size = Lang.length(obj);
    if (size < 1)
        return obj;
    Object first = Lang.first(obj);

    这里两个return是两个保护性校验。正常情况下执行

    final EntityOperator opt = _optBy(Lang.first(obj));
    int size = Lang.length(obj);
    Object first = Lang.first(obj);

    也就是说first通常会执行到,虽然 Lang.first(obj) 的成本并不高,
    但是感觉调一次清爽些。
    另外在 null != opt 时,
    size 总是 >= 1的

        final EntityOperator opt = _optBy(Lang.first(obj));
        if (null == opt)
            return null;
        int size = Lang.length(obj);
        if (size < 1)
            return obj;
    	Object first = Lang.first(obj);

        这里两个return是两个保护性校验。正常情况下执行
		
        final EntityOperator opt = _optBy(Lang.first(obj));
        int size = Lang.length(obj);
        Object first = Lang.first(obj);
			
        也就是说first通常会执行到,虽然	Lang.first(obj)的成本并不高,
        但是感觉调一次清爽些。
        另外在 null != opt 时,
        size 总是 >= 1的
@wendal wendal merged commit 31b95db into nutzam:master Oct 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants