[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=663165&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-663165 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 09/Oct/21 10:58 Start Date: 09/Oct/21 10:58 Worklog Time Spent: 10m Work Description: HubertWo edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-936515051 > > @XenoAmess Could you please be more descriptive? The only `String.valueOf` I have added are in high level methods, main logic does not. Actually I removed `String.valueOf` from loops. Sorry for answering in comment, but there's no way to add reply to your comment. > > @HubertWo > > Hi. > > I find some time today for this question (finally). > > `The only `String.valueOf` I have added are in high level methods, main logic does not` > > This statement be correct, but also be where I worried about performance. > > Please look at the sources in JDK, where `java.lang.AbstractStringBuilder#append(boolean b)` > > In short, for basic types, should not convert them to String, but use StringBuilder directly, will bring far better performance. > > BUT I just foundout that you did not bring this issue, this issue is already in commons-lang before your pr. > > So I will not stop you from merging this in, but still I will find time to refactor the whole `join` serial functions later. I was not aware of that. I will be happy to introduce changes (with JMH tests) related to your suggestions in separate PR. I've crated new JIRA for it: https://issues.apache.org/jira/browse/LANG-1675 Thank you for your time @XenoAmess . Update: I've created PR with StringBuilder in StringUtils.join and JMH benchmarks. Please find it here: https://github.com/apache/commons-lang/pull/812 -- 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 Issue Time Tracking --- Worklog Id: (was: 663165) Time Spent: 8h 20m (was: 8h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 8h 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=663149&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-663149 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 09/Oct/21 08:35 Start Date: 09/Oct/21 08:35 Worklog Time Spent: 10m Work Description: HubertWo edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-936515051 > > @XenoAmess Could you please be more descriptive? The only `String.valueOf` I have added are in high level methods, main logic does not. Actually I removed `String.valueOf` from loops. Sorry for answering in comment, but there's no way to add reply to your comment. > > @HubertWo > > Hi. > > I find some time today for this question (finally). > > `The only `String.valueOf` I have added are in high level methods, main logic does not` > > This statement be correct, but also be where I worried about performance. > > Please look at the sources in JDK, where `java.lang.AbstractStringBuilder#append(boolean b)` > > In short, for basic types, should not convert them to String, but use StringBuilder directly, will bring far better performance. > > BUT I just foundout that you did not bring this issue, this issue is already in commons-lang before your pr. > > So I will not stop you from merging this in, but still I will find time to refactor the whole `join` serial functions later. I was not aware of that. I will be happy to introduce changes (with JMH tests) related to your suggestions in separate PR. I've crated new JIRA for it: https://issues.apache.org/jira/browse/LANG-1675 Thank you for your time @XenoAmess . Update: Draft changes may be found here: https://github.com/HubertWo/commons-lang/pull/4/files -- 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 Issue Time Tracking --- Worklog Id: (was: 663149) Time Spent: 8h 10m (was: 8h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 8h 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=663144&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-663144 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 09/Oct/21 08:15 Start Date: 09/Oct/21 08:15 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-893057654 [![Coverage Status](https://coveralls.io/builds/43386039/badge)](https://coveralls.io/builds/43386039) Coverage decreased (-0.003%) to 94.943% when pulling **554f8c785f5350c5f1e1b1b058dcab96e389c009 on HubertWo:fix/LANG-1593-join-string-delimiter** into **a3a064587470d9ac3be469d0d6dd88f1b95dc669 on apache:master**. -- 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 Issue Time Tracking --- Worklog Id: (was: 663144) Time Spent: 8h (was: 7h 50m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 8h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=661011&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-661011 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 06/Oct/21 15:36 Start Date: 06/Oct/21 15:36 Worklog Time Spent: 10m Work Description: HubertWo commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-936515051 > > @XenoAmess Could you please be more descriptive? The only `String.valueOf` I have added are in high level methods, main logic does not. Actually I removed `String.valueOf` from loops. Sorry for answering in comment, but there's no way to add reply to your comment. > > @HubertWo > > Hi. > > I find some time today for this question (finally). > > `The only `String.valueOf` I have added are in high level methods, main logic does not` > > This statement be correct, but also be where I worried about performance. > > Please look at the sources in JDK, where `java.lang.AbstractStringBuilder#append(boolean b)` > > In short, for basic types, should not convert them to String, but use StringBuilder directly, will bring far better performance. > > BUT I just foundout that you did not bring this issue, this issue is already in commons-lang before your pr. > > So I will not stop you from merging this in, but still I will find time to refactor the whole `join` serial functions later. I was not aware of that. I will be happy to introduce changes (with JMH tests) related to your suggestions in separate PR. I've crated new JIRA for it: https://issues.apache.org/jira/browse/LANG-1675 Thank you for your time @XenoAmess . -- 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 Issue Time Tracking --- Worklog Id: (was: 661011) Time Spent: 7h 50m (was: 7h 40m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 7h 50m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=660024&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-660024 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 05/Oct/21 00:52 Start Date: 05/Oct/21 00:52 Worklog Time Spent: 10m Work Description: XenoAmess commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-933970122 > @XenoAmess Could you please be more descriptive? The only `String.valueOf` I have added are in high level methods, main logic does not. Actually I removed `String.valueOf` from loops. Sorry for answering in comment, but there's no way to add reply to your comment. @HubertWo Hi. I find some time today for this question (finally). `The only `String.valueOf` I have added are in high level methods, main logic does not` This statement be correct, but also be where I worried about performance. Please look at the sources in JDK, where `java.lang.AbstractStringBuilder#append(boolean b)` In short, for basic types, should not convert them to String, but use StringBuilder directly, will bring far better performance. BUT I just foundout that you did not bring this issue, this issue is already in commons-lang before your pr. So I will not stop you from merging this in, but still I will find time to refactor the whole `join` serial functions later. -- 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 Issue Time Tracking --- Worklog Id: (was: 660024) Time Spent: 7h 40m (was: 7.5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 7h 40m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=652774&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-652774 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 20/Sep/21 05:36 Start Date: 20/Sep/21 05:36 Worklog Time Spent: 10m Work Description: HubertWo commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-922648660 @garydgregory BUMP -- 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 Issue Time Tracking --- Worklog Id: (was: 652774) Time Spent: 7.5h (was: 7h 20m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 7.5h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=646234&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-646234 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 03/Sep/21 09:44 Start Date: 03/Sep/21 09:44 Worklog Time Spent: 10m Work Description: HubertWo edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-912228158 @garydgregory looks like I've addressed all the questions. Could you please review again? Hope it will be LGTM this time :) -- 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 Issue Time Tracking --- Worklog Id: (was: 646234) Time Spent: 7h 20m (was: 7h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 7h 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=646181&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-646181 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 03/Sep/21 05:29 Start Date: 03/Sep/21 05:29 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-893057654 [![Coverage Status](https://coveralls.io/builds/42631291/badge)](https://coveralls.io/builds/42631291) Coverage increased (+0.009%) to 94.96% when pulling **26f3b05a71bebafff7793f4700375f00e9a7847b on HubertWo:fix/LANG-1593-join-string-delimiter** into **4ff5e2b9f98e5ca9dd105a2d08477e0371ae8832 on apache:master**. -- 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 Issue Time Tracking --- Worklog Id: (was: 646181) Time Spent: 7h 10m (was: 7h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 7h 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=646163&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-646163 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 03/Sep/21 03:32 Start Date: 03/Sep/21 03:32 Worklog Time Spent: 10m Work Description: HubertWo commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-912228158 @garydgregory looks like I've addressed all the questions. Could you please review again? Hope this will be LGTM this time :) -- 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 Issue Time Tracking --- Worklog Id: (was: 646163) Time Spent: 7h (was: 6h 50m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 7h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=646161&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-646161 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 03/Sep/21 03:30 Start Date: 03/Sep/21 03:30 Worklog Time Spent: 10m Work Description: HubertWo commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-912227388 @XenoAmess Could you please be more descriptive? The only ```String.valueOf``` I have added are in high level methods, main logic does not. Actually I removed ```String.valueOf``` from loops. Sorry for answering in comment, but there's no way to add reply to your comment. -- 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 Issue Time Tracking --- Worklog Id: (was: 646161) Time Spent: 6h 50m (was: 6h 40m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 6h 50m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=646160&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-646160 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 03/Sep/21 03:25 Start Date: 03/Sep/21 03:25 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r701557984 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ## @@ -1226,6 +1241,8 @@ public void testJoin_ArrayOfShorts() { assertNull(StringUtils.join((short[]) null, SEPARATOR_CHAR, 0, 1)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 0, 0)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 1, 0)); +assertEquals("1,2", StringUtils.join(SHORT_PRIM_LIST, SEPARATOR)); Review comment: The joining part is done via ```java.util.StringJoiner``` with accepts only```CharSequence``` in constructor, so it's made to use more than one character as separator by default. Don't you think that testing that would be redundant? -- 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 Issue Time Tracking --- Worklog Id: (was: 646160) Time Spent: 6h 40m (was: 6.5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 6h 40m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=646157&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-646157 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 03/Sep/21 03:14 Start Date: 03/Sep/21 03:14 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r701554900 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ## @@ -1355,15 +1372,6 @@ public void testJoin_Objectarray() { assertEquals("foo2", StringUtils.join(MIXED_TYPE_LIST)); } -@Disabled Review comment: This is exactly the test that exposes this bug: ```testLang1593```. Please find the same assertion here ```testJoin_ArrayOfInt``` in ```StringUtilsTest``` ``` assertEquals("1,2", StringUtils.join(INT_PRIM_LIST, SEPARATOR));``` When it comes to coverage, it looks like ```join``` methods have 100% coverage. -- 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 Issue Time Tracking --- Worklog Id: (was: 646157) Time Spent: 6.5h (was: 6h 20m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 6.5h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=646155&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-646155 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 03/Sep/21 03:02 Start Date: 03/Sep/21 03:02 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r701551517 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4858,6 +5082,209 @@ public static String join(final short[] array, final char delimiter, final int s return join(elements, null); } +/** + * Joins the elements of the provided array into a single String + * containing the provided list of elements. + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * StringUtils.join(null)= null + * StringUtils.join([]) = "" + * StringUtils.join([null]) = "" + * StringUtils.join([1, 2, 3], ";") = "1;2;3" + * StringUtils.join([1, 2, 3], null) = "123" + * + * + * @param elements + *the values to join together, may be null + * @param separator + *the separator String to use + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final byte[] elements, final String separator) { +return elements == null ? null : join(elements, separator, 0, elements.length); +} + +/** + * Joins the elements of the provided array into a single String + * containing the provided list of elements. + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * StringUtils.join(null) = null + * StringUtils.join([]) = "" + * StringUtils.join([null]) = "" + * StringUtils.join([false,true,false], ";") = "false;true;false" + * StringUtils.join([false,true,false], null) = "falsetruefalse" + * + * + * @param elements + *the values to join together, may be null + * @param separator + *the separator String to use + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final boolean[] elements, final String separator) { +return elements == null ? null : join(elements, separator, 0, elements.length); +} + +/** + * Joins the elements of the provided array into a single String + * containing the provided list of elements. + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * StringUtils.join(null) = null + * StringUtils.join([]) = "" + * StringUtils.join([null]) = "" + * StringUtils.join(['a', 'b', 'c'], ";") = "a;b;c" + * StringUtils.join(['a', 'b', 'c'], null) = "abc" + * + * + * @param elements + *the values to join together, may be null + * @param separator + *the separator String to use + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final char[] elements, final String separator) { +return elements == null ? null : join(elements, separator, 0, elements.length); Review comment: 1. The method is public - so users may pass ```null``` as ```elements``` which will cause ```NPE``` in the same line ```elements.length``` ``` assertNull(StringUtils.join((char[]) null, "-")); // throws NPE if null check is removed ``` 2. This case was not tested, so I added additional assertions in tests to cover it. -- 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 Issue Time Tracking --- Worklog Id: (was: 646155) Time Spent: 6h 20m (was: 6h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons L
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=645041&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-645041 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 01/Sep/21 09:29 Start Date: 01/Sep/21 09:29 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r699853027 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ## @@ -1226,6 +1241,8 @@ public void testJoin_ArrayOfShorts() { assertNull(StringUtils.join((short[]) null, SEPARATOR_CHAR, 0, 1)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 0, 0)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 1, 0)); +assertEquals("1,2", StringUtils.join(SHORT_PRIM_LIST, SEPARATOR)); Review comment: Sorry for the late reply, I was on vac. I will take a look on your comments and try to apply changes later this week. -- 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 Issue Time Tracking --- Worklog Id: (was: 645041) Time Spent: 6h 10m (was: 6h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 6h 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=644839&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-644839 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 01/Sep/21 09:08 Start Date: 01/Sep/21 09:08 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r699367138 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ## @@ -1226,6 +1241,8 @@ public void testJoin_ArrayOfShorts() { assertNull(StringUtils.join((short[]) null, SEPARATOR_CHAR, 0, 1)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 0, 0)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 1, 0)); +assertEquals("1,2", StringUtils.join(SHORT_PRIM_LIST, SEPARATOR)); Review comment: @HubertWo The point of String vs char separators is that a String can be longer than one character, so you should test for String separators longer than one character to make sure the right work takes place under the covers. -- 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 Issue Time Tracking --- Worklog Id: (was: 644839) Time Spent: 6h (was: 5h 50m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 6h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=644768&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-644768 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 01/Sep/21 05:24 Start Date: 01/Sep/21 05:24 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r699853027 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ## @@ -1226,6 +1241,8 @@ public void testJoin_ArrayOfShorts() { assertNull(StringUtils.join((short[]) null, SEPARATOR_CHAR, 0, 1)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 0, 0)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 1, 0)); +assertEquals("1,2", StringUtils.join(SHORT_PRIM_LIST, SEPARATOR)); Review comment: Sorry for the late reply, I was on vac. I will take a look on your comments and try to apply changes later this week. -- 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 Issue Time Tracking --- Worklog Id: (was: 644768) Time Spent: 5h 50m (was: 5h 40m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 5h 50m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=644091&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-644091 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 31/Aug/21 14:46 Start Date: 31/Aug/21 14:46 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r699367138 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ## @@ -1226,6 +1241,8 @@ public void testJoin_ArrayOfShorts() { assertNull(StringUtils.join((short[]) null, SEPARATOR_CHAR, 0, 1)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 0, 0)); assertEquals(StringUtils.EMPTY, StringUtils.join(SHORT_PRIM_LIST, SEPARATOR_CHAR, 1, 0)); +assertEquals("1,2", StringUtils.join(SHORT_PRIM_LIST, SEPARATOR)); Review comment: @HubertWo The point of String vs char separators is that a String can be longer than one character, so you should test for String separators longer than one character to make sure the right work takes place under the covers. -- 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 Issue Time Tracking --- Worklog Id: (was: 644091) Time Spent: 5h 40m (was: 5.5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 5h 40m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=641288&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-641288 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 24/Aug/21 19:59 Start Date: 24/Aug/21 19:59 Worklog Time Spent: 10m Work Description: XenoAmess commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-904933540 I just think it use too many `String.valueOf` Is it really performance acceptable? I do think it it need a jmh... -- 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 Issue Time Tracking --- Worklog Id: (was: 641288) Time Spent: 5.5h (was: 5h 20m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 5.5h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=641093&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-641093 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 24/Aug/21 13:29 Start Date: 24/Aug/21 13:29 Worklog Time Spent: 10m Work Description: garydgregory commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-904643735 @HubertWo Thank you for your update. Please see my comments. -- 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 Issue Time Tracking --- Worklog Id: (was: 641093) Time Spent: 5h 20m (was: 5h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 5h 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=641091&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-641091 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 24/Aug/21 13:28 Start Date: 24/Aug/21 13:28 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r694850165 ## File path: src/test/java/org/apache/commons/lang3/StringUtilsTest.java ## @@ -1355,15 +1372,6 @@ public void testJoin_Objectarray() { assertEquals("foo2", StringUtils.join(MIXED_TYPE_LIST)); } -@Disabled Review comment: Was this test removed because the code is already covered elsewhere? Did you confirm this by looking at the JaCoCo report? -- 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 Issue Time Tracking --- Worklog Id: (was: 641091) Time Spent: 5h 10m (was: 5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 5h 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=641090&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-641090 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 24/Aug/21 13:27 Start Date: 24/Aug/21 13:27 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r694849198 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4858,6 +5082,209 @@ public static String join(final short[] array, final char delimiter, final int s return join(elements, null); } +/** + * Joins the elements of the provided array into a single String + * containing the provided list of elements. + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * StringUtils.join(null)= null + * StringUtils.join([]) = "" + * StringUtils.join([null]) = "" + * StringUtils.join([1, 2, 3], ";") = "1;2;3" + * StringUtils.join([1, 2, 3], null) = "123" + * + * + * @param elements + *the values to join together, may be null + * @param separator + *the separator String to use + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final byte[] elements, final String separator) { +return elements == null ? null : join(elements, separator, 0, elements.length); +} + +/** + * Joins the elements of the provided array into a single String + * containing the provided list of elements. + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * StringUtils.join(null) = null + * StringUtils.join([]) = "" + * StringUtils.join([null]) = "" + * StringUtils.join([false,true,false], ";") = "false;true;false" + * StringUtils.join([false,true,false], null) = "falsetruefalse" + * + * + * @param elements + *the values to join together, may be null + * @param separator + *the separator String to use + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final boolean[] elements, final String separator) { +return elements == null ? null : join(elements, separator, 0, elements.length); +} + +/** + * Joins the elements of the provided array into a single String + * containing the provided list of elements. + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * StringUtils.join(null) = null + * StringUtils.join([]) = "" + * StringUtils.join([null]) = "" + * StringUtils.join(['a', 'b', 'c'], ";") = "a;b;c" + * StringUtils.join(['a', 'b', 'c'], null) = "abc" + * + * + * @param elements + *the values to join together, may be null + * @param separator + *the separator String to use + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final char[] elements, final String separator) { +return elements == null ? null : join(elements, separator, 0, elements.length); Review comment: The null checks in these methods are superfluous as the join method called already checks for the same condition. Less boilerplate is better IMO. -- 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 Issue Time Tracking --- Worklog Id: (was: 641090) Time Spent: 5h (was: 4h 50m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 5h > Remaining Estimate: 0h > > F
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=640495&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-640495 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 22/Aug/21 07:16 Start Date: 22/Aug/21 07:16 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-893057654 [![Coverage Status](https://coveralls.io/builds/42318946/badge)](https://coveralls.io/builds/42318946) Coverage increased (+0.009%) to 94.994% when pulling **5b1a23e2a740bf276cc2bffd53e9457dbbd66887 on HubertWo:fix/LANG-1593-join-string-delimiter** into **ce477d9140f1439c44c7a852d7df1e069e21cb85 on apache:master**. -- 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 Issue Time Tracking --- Worklog Id: (was: 640495) Time Spent: 4h 50m (was: 4h 40m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 4h 50m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=640494&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-640494 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 22/Aug/21 07:10 Start Date: 22/Aug/21 07:10 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r693455055 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -3922,6 +3922,37 @@ public static String join(final boolean[] array, final char delimiter) { * @since 3.12.0 */ public static String join(final boolean[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * Joins the elements of the provided array into a single String containing the provided list of elements. Review comment: Thanks for pointing this out, I didn't know about such rule. Unnecessary paragraph tags removed. -- 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 Issue Time Tracking --- Worklog Id: (was: 640494) Time Spent: 4h 40m (was: 4.5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 4h 40m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=640493&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-640493 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 22/Aug/21 07:09 Start Date: 22/Aug/21 07:09 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r693455055 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -3922,6 +3922,37 @@ public static String join(final boolean[] array, final char delimiter) { * @since 3.12.0 */ public static String join(final boolean[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * Joins the elements of the provided array into a single String containing the provided list of elements. Review comment: Thanks for pointing this out, I didn't know about such rule. Additional paragraph tags removed. -- 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 Issue Time Tracking --- Worklog Id: (was: 640493) Time Spent: 4.5h (was: 4h 20m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 4.5h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=640443&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-640443 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 21/Aug/21 10:16 Start Date: 21/Aug/21 10:16 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r693335904 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -3922,6 +3922,37 @@ public static String join(final boolean[] array, final char delimiter) { * @since 3.12.0 */ public static String join(final boolean[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * Joins the elements of the provided array into a single String containing the provided list of elements. Review comment: The first sentence in a Javadoc comment is special, it is the summary and should not be additionally wrapped in a paragraph. -- 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 Issue Time Tracking --- Worklog Id: (was: 640443) Time Spent: 4h 20m (was: 4h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 4h 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=639980&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-639980 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 19/Aug/21 18:09 Start Date: 19/Aug/21 18:09 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-893057654 [![Coverage Status](https://coveralls.io/builds/42276554/badge)](https://coveralls.io/builds/42276554) Coverage increased (+0.009%) to 94.994% when pulling **f18c98ef594fb9cc09ad0cb83eddb0f767e1437e on HubertWo:fix/LANG-1593-join-string-delimiter** into **ce477d9140f1439c44c7a852d7df1e069e21cb85 on apache:master**. -- 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 Issue Time Tracking --- Worklog Id: (was: 639980) Time Spent: 4h 10m (was: 4h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 4h 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=638580&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-638580 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 17/Aug/21 08:56 Start Date: 17/Aug/21 08:56 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-893057654 [![Coverage Status](https://coveralls.io/builds/42198791/badge)](https://coveralls.io/builds/42198791) Coverage increased (+0.009%) to 94.993% when pulling **3dc68c251a9593bb9ef894c81cf78e616c85ff55 on HubertWo:fix/LANG-1593-join-string-delimiter** into **a6df7f74564b9432bf38fe33c4adc0bc529bf7c9 on apache:master**. -- 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 Issue Time Tracking --- Worklog Id: (was: 638580) Time Spent: 4h (was: 3h 50m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 4h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=634905&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-634905 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 06/Aug/21 01:06 Start Date: 06/Aug/21 01:06 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-893057654 [![Coverage Status](https://coveralls.io/builds/41948306/badge)](https://coveralls.io/builds/41948306) Coverage increased (+0.009%) to 95.004% when pulling **9c29274049f6140df3cc6f14e88a8c25f1597d3f on HubertWo:fix/LANG-1593-join-string-delimiter** into **7c658527094083b2037d362916adf8eb2493ea65 on apache:master**. -- 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 Issue Time Tracking --- Worklog Id: (was: 634905) Time Spent: 3h 50m (was: 3h 40m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 3h 50m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=634754&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-634754 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 05/Aug/21 19:19 Start Date: 05/Aug/21 19:19 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683724884 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4858,6 +5127,38 @@ public static String join(final short[] array, final char delimiter, final int s return join(elements, null); } +public static String join(byte[] elements, String separator) { Review comment: Added. -- 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 Issue Time Tracking --- Worklog Id: (was: 634754) Time Spent: 3h 40m (was: 3.5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 3h 40m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=634752&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-634752 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 05/Aug/21 19:10 Start Date: 05/Aug/21 19:10 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683719682 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4307,13 +4481,48 @@ public static String join(final int[] array, final char separator) { * @since 3.2 */ public static String join(final int[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * + * Joins the elements of the provided array into a single String containing the provided list of elements. + * + * + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * + * StringUtils.join(null, *) = null + * StringUtils.join([], *) = "" + * StringUtils.join([null], *) = "" + * StringUtils.join([1, 2, 3], ';') = "1;2;3" + * StringUtils.join([1, 2, 3], null) = "123" + * + * + * @param array + *the array of values to join together, may be null + * @param delimiter + *the separator String to use + * @param startIndex + *the first index to start joining from. It is an error to pass in a start index past the end of the + *array + * @param endIndex + *the index to stop joining from (exclusive). It is an error to pass in an end index past the end of + *the array + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final int[] array, final String delimiter, final int startIndex, final int endIndex) { if (array == null) { return null; } if (endIndex - startIndex <= 0) { return EMPTY; } -final StringJoiner joiner = newStringJoiner(delimiter); +final StringJoiner joiner = new StringJoiner(toStringOrEmpty(delimiter)); Review comment: Valid point. I brought it back. -- 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 Issue Time Tracking --- Worklog Id: (was: 634752) Time Spent: 3.5h (was: 3h 20m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 3.5h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=634751&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-634751 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 05/Aug/21 19:10 Start Date: 05/Aug/21 19:10 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683719485 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4818,13 +5052,48 @@ public static String join(final short[] array, final char delimiter) { * @since 3.2 */ public static String join(final short[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * Review comment: I've followed convention from other Javadoc in the file. Fixed. -- 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 Issue Time Tracking --- Worklog Id: (was: 634751) Time Spent: 3h 20m (was: 3h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 3h 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=634750&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-634750 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 05/Aug/21 19:09 Start Date: 05/Aug/21 19:09 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683718647 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4858,6 +5127,38 @@ public static String join(final short[] array, final char delimiter, final int s return join(elements, null); } +public static String join(byte[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(boolean[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(char[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(double[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(float[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(int[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(long[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(short[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} Review comment: Done. -- 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 Issue Time Tracking --- Worklog Id: (was: 634750) Time Spent: 3h 10m (was: 3h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 3h 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=634430&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-634430 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 05/Aug/21 11:49 Start Date: 05/Aug/21 11:49 Worklog Time Spent: 10m Work Description: coveralls commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-893057654 [![Coverage Status](https://coveralls.io/builds/41915872/badge)](https://coveralls.io/builds/41915872) Coverage increased (+0.009%) to 95.003% when pulling **ed64d9ca588414e1aa5bca026d41a1775e39c0d2 on HubertWo:fix/LANG-1593-join-string-delimiter** into **7c658527094083b2037d362916adf8eb2493ea65 on apache:master**. -- 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 Issue Time Tracking --- Worklog Id: (was: 634430) Time Spent: 3h (was: 2h 50m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 3h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=634076&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-634076 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 05/Aug/21 11:09 Start Date: 05/Aug/21 11:09 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683017191 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4858,6 +5127,38 @@ public static String join(final short[] array, final char delimiter, final int s return join(elements, null); } +public static String join(byte[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(boolean[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(char[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(double[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(float[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(int[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(long[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(short[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} Review comment: Remove useless parentheses please. ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4858,6 +5127,38 @@ public static String join(final short[] array, final char delimiter, final int s return join(elements, null); } +public static String join(byte[] elements, String separator) { Review comment: All public methods should be Javadoc'd. ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4818,13 +5052,48 @@ public static String join(final short[] array, final char delimiter) { * @since 3.2 */ public static String join(final short[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * Review comment: The 1st para of a Javadoc is automatically in a paragraph IIRC. ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4307,13 +4481,48 @@ public static String join(final int[] array, final char separator) { * @since 3.2 */ public static String join(final int[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * + * Joins the elements of the provided array into a single String containing the provided list of elements. + * + * + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * + * StringUtils.join(null, *) = null + * StringUtils.join([], *) = "" + * StringUtils.join([null], *) = "" + * StringUtils.join([1, 2, 3], ';') = "1;2;3" + * StringUtils.join([1, 2, 3], null) = "123" + * + * + * @param array + *the array of values to join together, may be null + * @param delimiter + *the separator String to use + * @param startIndex + *the first index to start joining from. It is an error to pass in a start index past the end of the + *array + * @param endIndex + *the index to stop joining from (exclusive). It is an error to pass in an end index past the end of + *the array + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final int[] array, final String delimiter, final int startIndex, final int endIndex) { if (array == null) { return null; } if (endIndex - startIndex <= 0) { return EMPTY
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=633890&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-633890 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 05/Aug/21 00:07 Start Date: 05/Aug/21 00:07 Worklog Time Spent: 10m Work Description: coveralls commented on pull request #784: URL: https://github.com/apache/commons-lang/pull/784#issuecomment-893057654 [![Coverage Status](https://coveralls.io/builds/41915872/badge)](https://coveralls.io/builds/41915872) Coverage increased (+0.009%) to 95.003% when pulling **ed64d9ca588414e1aa5bca026d41a1775e39c0d2 on HubertWo:fix/LANG-1593-join-string-delimiter** into **7c658527094083b2037d362916adf8eb2493ea65 on apache:master**. -- 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 Issue Time Tracking --- Worklog Id: (was: 633890) Time Spent: 2h 40m (was: 2.5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 2h 40m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=633874&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-633874 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 04/Aug/21 23:10 Start Date: 04/Aug/21 23:10 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683017648 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4818,13 +5052,48 @@ public static String join(final short[] array, final char delimiter) { * @since 3.2 */ public static String join(final short[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * Review comment: The 1st para of a Javadoc is automatically in a paragraph IIRC. -- 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 Issue Time Tracking --- Worklog Id: (was: 633874) Time Spent: 2h 20m (was: 2h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 2h 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=633875&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-633875 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 04/Aug/21 23:10 Start Date: 04/Aug/21 23:10 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683017853 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4307,13 +4481,48 @@ public static String join(final int[] array, final char separator) { * @since 3.2 */ public static String join(final int[] array, final char delimiter, final int startIndex, final int endIndex) { +return join(array, String.valueOf(delimiter), startIndex, endIndex); +} + +/** + * + * Joins the elements of the provided array into a single String containing the provided list of elements. + * + * + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * + * StringUtils.join(null, *) = null + * StringUtils.join([], *) = "" + * StringUtils.join([null], *) = "" + * StringUtils.join([1, 2, 3], ';') = "1;2;3" + * StringUtils.join([1, 2, 3], null) = "123" + * + * + * @param array + *the array of values to join together, may be null + * @param delimiter + *the separator String to use + * @param startIndex + *the first index to start joining from. It is an error to pass in a start index past the end of the + *array + * @param endIndex + *the index to stop joining from (exclusive). It is an error to pass in an end index past the end of + *the array + * @return the joined String, {@code null} if null array input + * @since 3.13.0 + */ +public static String join(final int[] array, final String delimiter, final int startIndex, final int endIndex) { if (array == null) { return null; } if (endIndex - startIndex <= 0) { return EMPTY; } -final StringJoiner joiner = newStringJoiner(delimiter); +final StringJoiner joiner = new StringJoiner(toStringOrEmpty(delimiter)); Review comment: Why did you remove the private helper method? -- 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 Issue Time Tracking --- Worklog Id: (was: 633875) Time Spent: 2.5h (was: 2h 20m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 2.5h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=633873&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-633873 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 04/Aug/21 23:09 Start Date: 04/Aug/21 23:09 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683017414 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4858,6 +5127,38 @@ public static String join(final short[] array, final char delimiter, final int s return join(elements, null); } +public static String join(byte[] elements, String separator) { Review comment: All public methods should be Javadoc'd. -- 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 Issue Time Tracking --- Worklog Id: (was: 633873) Time Spent: 2h 10m (was: 2h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 2h 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=633872&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-633872 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 04/Aug/21 23:08 Start Date: 04/Aug/21 23:08 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #784: URL: https://github.com/apache/commons-lang/pull/784#discussion_r683017191 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -4858,6 +5127,38 @@ public static String join(final short[] array, final char delimiter, final int s return join(elements, null); } +public static String join(byte[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(boolean[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(char[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(double[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(float[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(int[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(long[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} + +public static String join(short[] elements, String separator) { +return (elements == null) ? null : join(elements, separator, 0, elements.length); +} Review comment: Remove useless parentheses please. -- 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 Issue Time Tracking --- Worklog Id: (was: 633872) Time Spent: 2h (was: 1h 50m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 2h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=555125&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555125 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 20/Feb/21 10:12 Start Date: 20/Feb/21 10:12 Worklog Time Spent: 10m Work Description: HubertWo closed pull request #635: URL: https://github.com/apache/commons-lang/pull/635 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 555125) Time Spent: 1h 50m (was: 1h 40m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 1h 50m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=555119&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-555119 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 20/Feb/21 10:03 Start Date: 20/Feb/21 10:03 Worklog Time Spent: 10m Work Description: HubertWo commented on pull request #635: URL: https://github.com/apache/commons-lang/pull/635#issuecomment-782599104 Pulled changes from apache:master for the third time. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 555119) Time Spent: 1h 40m (was: 1.5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 1h 40m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=521327&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-521327 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 07/Dec/20 18:23 Start Date: 07/Dec/20 18:23 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #635: URL: https://github.com/apache/commons-lang/pull/635#issuecomment-718230487 [![Coverage Status](https://coveralls.io/builds/35510567/badge)](https://coveralls.io/builds/35510567) Coverage increased (+0.004%) to 95.02% when pulling **0662d757cbfadef5cf69c37d8c446c49cdcb12f1 on HubertWo:LANG-1593-join-string-delimiter** into **041cf552c59a939aa54e9f8708384f0adc19dbf3 on apache:master**. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 521327) Time Spent: 1.5h (was: 1h 20m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 1.5h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=521306&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-521306 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 07/Dec/20 17:26 Start Date: 07/Dec/20 17:26 Worklog Time Spent: 10m Work Description: HubertWo commented on pull request #635: URL: https://github.com/apache/commons-lang/pull/635#issuecomment-740063050 Pulled changes from apache:master. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 521306) Time Spent: 1h 20m (was: 1h 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 1h 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=516239&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-516239 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 24/Nov/20 16:39 Start Date: 24/Nov/20 16:39 Worklog Time Spent: 10m Work Description: HubertWo commented on pull request #635: URL: https://github.com/apache/commons-lang/pull/635#issuecomment-733097313 @garydgregory May I ask you for second review and approval? :) 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 516239) Time Spent: 1h 10m (was: 1h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 1h 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=513645&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-513645 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 18/Nov/20 17:21 Start Date: 18/Nov/20 17:21 Worklog Time Spent: 10m Work Description: arturobernalg commented on pull request #635: URL: https://github.com/apache/commons-lang/pull/635#issuecomment-729827347 LGTM 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 513645) Time Spent: 1h (was: 50m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 1h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=506150&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-506150 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 29/Oct/20 10:28 Start Date: 29/Oct/20 10:28 Worklog Time Spent: 10m Work Description: coveralls edited a comment on pull request #635: URL: https://github.com/apache/commons-lang/pull/635#issuecomment-718230487 [![Coverage Status](https://coveralls.io/builds/34556214/badge)](https://coveralls.io/builds/34556214) Coverage increased (+0.004%) to 94.951% when pulling **a648ef35435d67c17152d43622291afb3c4fde1a on HubertWo:LANG-1593-join-string-delimiter** into **d9f5b615675d525bccc2c04ad8f261a783386c4c on apache:master**. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 506150) Time Spent: 50m (was: 40m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 50m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=506129&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-506129 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 29/Oct/20 09:10 Start Date: 29/Oct/20 09:10 Worklog Time Spent: 10m Work Description: HubertWo commented on a change in pull request #635: URL: https://github.com/apache/commons-lang/pull/635#discussion_r514105654 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -3900,6 +3900,41 @@ public static String join(final byte[] array, final char separator) { * @since 3.2 */ public static String join(final byte[] array, final char separator, final int startIndex, final int endIndex) { +return join(array, Character.toString(separator), startIndex, endIndex); +} + +/** + * + * Joins the elements of the provided array into a single String containing the provided list of elements. + * + * + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * + * StringUtils.join(null, *) = null + * StringUtils.join([], *) = "" + * StringUtils.join([null], *) = "" + * StringUtils.join([1, 2, 3], ';') = "1;2;3" + * StringUtils.join([1, 2, 3], null) = "123" + * + * + * @param array + *the array of values to join together, may be null + * @param separator + *the separator String to use + * @param startIndex + *the first index to start joining from. It is an error to pass in a start index past the end of the + *array + * @param endIndex + *the index to stop joining from (exclusive). It is an error to pass in an end index past the end of + *the array + * @return the joined String, {@code null} if null array input + * @since 3.2 Review comment: My mistake. Fixed. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 506129) Time Spent: 40m (was: 0.5h) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 40m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=505934&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-505934 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 28/Oct/20 21:53 Start Date: 28/Oct/20 21:53 Worklog Time Spent: 10m Work Description: coveralls commented on pull request #635: URL: https://github.com/apache/commons-lang/pull/635#issuecomment-718230487 [![Coverage Status](https://coveralls.io/builds/34541207/badge)](https://coveralls.io/builds/34541207) Coverage increased (+0.004%) to 94.951% when pulling **2f20b9df053e7582f52308e05d497bc46f579422 on HubertWo:LANG-1593-join-string-delimiter** into **d9f5b615675d525bccc2c04ad8f261a783386c4c on apache:master**. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 505934) Time Spent: 0.5h (was: 20m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 0.5h > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=505914&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-505914 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 28/Oct/20 20:54 Start Date: 28/Oct/20 20:54 Worklog Time Spent: 10m Work Description: garydgregory commented on a change in pull request #635: URL: https://github.com/apache/commons-lang/pull/635#discussion_r513753596 ## File path: src/main/java/org/apache/commons/lang3/StringUtils.java ## @@ -3900,6 +3900,41 @@ public static String join(final byte[] array, final char separator) { * @since 3.2 */ public static String join(final byte[] array, final char separator, final int startIndex, final int endIndex) { +return join(array, Character.toString(separator), startIndex, endIndex); +} + +/** + * + * Joins the elements of the provided array into a single String containing the provided list of elements. + * + * + * + * No delimiter is added before or after the list. Null objects or empty strings within the array are represented + * by empty strings. + * + * + * + * StringUtils.join(null, *) = null + * StringUtils.join([], *) = "" + * StringUtils.join([null], *) = "" + * StringUtils.join([1, 2, 3], ';') = "1;2;3" + * StringUtils.join([1, 2, 3], null) = "123" + * + * + * @param array + *the array of values to join together, may be null + * @param separator + *the separator String to use + * @param startIndex + *the first index to start joining from. It is an error to pass in a start index past the end of the + *array + * @param endIndex + *the index to stop joining from (exclusive). It is an error to pass in an end index past the end of + *the array + * @return the joined String, {@code null} if null array input + * @since 3.2 Review comment: You're not adding method to the old version 3.2; the next version will be 3.12. 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 505914) Time Spent: 20m (was: 10m) > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 20m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Work logged] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter
[ https://issues.apache.org/jira/browse/LANG-1593?focusedWorklogId=505843&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-505843 ] ASF GitHub Bot logged work on LANG-1593: Author: ASF GitHub Bot Created on: 28/Oct/20 18:16 Start Date: 28/Oct/20 18:16 Worklog Time Spent: 10m Work Description: HubertWo opened a new pull request #635: URL: https://github.com/apache/commons-lang/pull/635 JIRA: https://issues.apache.org/jira/browse/LANG-1593 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking --- Worklog Id: (was: 505843) Remaining Estimate: 0h Time Spent: 10m > Common behaviour for StringUtils join APIs when called with char or String > delimiter > > > Key: LANG-1593 > URL: https://issues.apache.org/jira/browse/LANG-1593 > Project: Commons Lang > Issue Type: Improvement >Affects Versions: 3.4, 3.11 >Reporter: Kiruahxh >Priority: Minor > Time Spent: 10m > Remaining Estimate: 0h > > For now, join(int[], char) is working well. > However, the same join method called with a string delimiter behaves > differently : it returns a single memory address which is not the desired > behavior. > I think that, for coherence, calling StringUtils with a char or String > delimiter should return the exact same value. > Ex : > {code:java} > CLASSPATH="./commons-lang3-3.11.jar" jshell > | Welcome to JShell -- Version 11.0.8 > jshell> import org.apache.commons.lang3.StringUtils > jshell> int[] arr = {1, 2, 3, 4, 5, 6, 7}; > jshell> String result = StringUtils.join(arr, '-'); > result ==> "1-2-3-4-5-6-7" > jshell> String result = StringUtils.join(arr, "-"); > result ==> "[I@69663380-" > {code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)