remeio opened a new pull request, #1053:
URL: https://github.com/apache/commons-lang/pull/1053

   - Remove the unnecessary unboxing
   - Use special boolean values array instead of hard code:
   ```java
         // The left array (index%2==0) is the Boolean.TRUE strings, the right 
(index%2==1) is the Boolean.FALSE strings.
         // The strings have the same length (index%2==0?index:index+1) for 
each pair.
         final String[][] booleanValues = new String[][]{
                 {}, {},
                 {"y", "t", "1"}, {"n", "f", "0"},
                 {ON}, {NO},
                 {YES}, {OFF},
                 {TRUE}, {},
                 {}, {FALSE},
         };
   ``` 
   It has two advantages:
   
   1. For `OCP`, if we add new boolean values, we just need adjust the array
   2. Keep the same performance with old code
   
   It is good for short values such as `T`, `OK`, `NOT`, but it is not good for 
too long values such as `truthful`.
   ```java
   {
     {},
     {},
     {},
     {},
     {},
     {},
     {},  // empty array for seize a seat, :(
     {},
     { "truthful" }, 
    
   }
   ``` 
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to