Skip to content

LANG-1404 BooleanUtils.toBoolean(Integer) method added#337

Closed
Enigo wants to merge 1 commit intoapache:masterfrom
Enigo:LANG-1404_boolean_utils
Closed

LANG-1404 BooleanUtils.toBoolean(Integer) method added#337
Enigo wants to merge 1 commit intoapache:masterfrom
Enigo:LANG-1404_boolean_utils

Conversation

@Enigo
Copy link
Copy Markdown
Contributor

@Enigo Enigo commented Jul 12, 2018

Right now to convert an Integer to boolean there is either a null check needed:

final Integer value = 1;
if (value != null) {
    if(BooleanUtils.toBoolean(value)) {
        // some code
      }
}

or two methods call:

final Integer value = 1;
final Boolean b = BooleanUtils.toBooleanObject(value);
if (BooleanUtils.toBoolean(b)) {
    // some code
}

Some code-sugar is added with the help of method that accepts Integer and returns boolean:

final Integer value = 1;
if (BooleanUtils.toBoolean(value)) {
      // some code
}

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0003%) to 95.244% when pulling 32c8338 on Enigo:LANG-1404_boolean_utils into c241b09 on apache:master.

1 similar comment
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0003%) to 95.244% when pulling 32c8338 on Enigo:LANG-1404_boolean_utils into c241b09 on apache:master.

@Enigo Enigo closed this Jul 14, 2018
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