manzhizhen commented on PR #1190:
URL: https://github.com/apache/commons-lang/pull/1190#issuecomment-2017683383

   > No, I am asking: when would this be useful?
   > 
   > Is there some real-world situation where this method would be useful?
   
   For example, I have a string constant to indicate that the function is 
enabled:
   `
   public static final String OPEN_STRING = "1";
   `
   
   Then, under certain conditions, I need to determine whether the different 
attributes of a certain object are all open. If they are all open, I will 
perform certain business processing:
   `
           if (OPEN_STRING.equals(authority.canEdit()) && 
OPEN_STRING.equals(authority.canRead()) &&
                   OPEN_STRING.equals(authority.isManager()) && 
OPEN_STRING.equals(authority.isWorking())) {
                // do something
           }
   `
   If we have StringUtils # equalsAll, we can write as follows:
   `
           if (StringUtils.equalsAll(OPEN_STRING, authority.canEdit(), 
authority.canRead(), authority.isManager(), authority.isWorking())) {
                // do something
           }
   `
   
   I don't know if what I said is clear enough
   


-- 
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: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to