commit | e3e578c98878b6e5bc8b9140389ffe36c5651b56 | [log] [tgz] |
---|---|---|
author | Alex Blewitt <alex.blewitt@gmail.com> | Sun Sep 06 17:13:21 2015 +0100 |
committer | Alex Blewitt <alex.blewitt@gmail.com> | Mon Sep 07 22:49:13 2015 +0100 |
tree | 6c22e2cf834d3c6a267611f2d59b9d1c45511c90 | |
parent | 4c1b71edc5f460ce4dc183f592449b24dbe53c97 [diff] |
Bug 476724 - Remove new Boolean and Boolean.valueOf().booleanValue() The new Boolean constructor creates a new instance of a Boolean object, but it can easily be replaced with Boolean.valueOf which returns the reference to the global Boolean.TRUE or Boolean.FALSE. Replace calls to new Boolean() with Boolean.valueOf() for identical semantics except without object collection. Additionally Boolean.valueOf().booleanValue() is identical to Boolean.parseBoolean() and will result in no garbage. In addition, methods will be (slightly) smaller and parseBoolean will often be in-lined by the JIT, which can often prove that the value is non-null for faster checking. Replace Boolean.valueOf().booleanValue() chains with Boolean.parseBoolean(). Some other tests can use Wrapper.valueOf() to take advantage of the built-in caches that these objects maintain (for values in the range -128..127). Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com> Change-Id: I5da4216a26ffbb6b8fd3365515ee800dd82b36ae