[jira] [Commented] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2020-10-28 Thread Kiruahxh (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17222357#comment-17222357
 ] 

Kiruahxh commented on LANG-1593:


Thanks, seems great!

> 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)


[jira] [Commented] (LANG-1594) Add support for lambda expressions in StringUtils.join

2020-08-31 Thread Kiruahxh (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17187693#comment-17187693
 ] 

Kiruahxh commented on LANG-1594:


Yup, I agree we can do it with the streams API. However, this is much more 
verbose and I'd rather rely on StringUtils to do all the join tasks.
I think that a StringUtils.join lambda override would have a very 
understandable syntax.

> Add support for lambda expressions in StringUtils.join
> --
>
> Key: LANG-1594
> URL: https://issues.apache.org/jira/browse/LANG-1594
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.*
>Affects Versions: 3.11
>Reporter: Kiruahxh
>Priority: Minor
>
> It would be a nice addition to support lambda expressions in the 
> StringUtils.join overloads, they are supported in java 8  so there should not 
> be compatibility problems.
> This would simplify this kind of code :
> {code:java}
> List productList = new ArrayList();
> ...
> String ids = "";
> int i = 0;
> for (Product p : productList) {
> if (i != 0) {
> ids += ",";
> }
> ids += p.id;
> i++;
> }
> String sql = "UPDATE product SET published=1 WHERE id IN (" + list + ")";
> execUpdate(sql);{code}
> Fixed version :
> {code:java}
> List productList = new ArrayList();
> ...
> String ids = StringUtils.join(productList, ',', p -> String.valueOf(p.id))
> String sql = "UPDATE product SET published=1 WHERE id IN (" + list + ")";
> execUpdate(sql);
>  {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (LANG-1594) Add support for lambda expressions in StringUtils.join

2020-08-10 Thread Kiruahxh (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kiruahxh updated LANG-1594:
---
Summary: Add support for lambda expressions in StringUtils.join  (was: 
Support lambda expressions in StringUtils.join)

> Add support for lambda expressions in StringUtils.join
> --
>
> Key: LANG-1594
> URL: https://issues.apache.org/jira/browse/LANG-1594
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.*
>Affects Versions: 3.11
>Reporter: Kiruahxh
>Priority: Minor
>
> It would be a nice addition to support lambda expressions in the 
> StringUtils.join overloads, they are supported in java 8  so there should not 
> be compatibility problems.
> This would simplify this kind of code :
> {code:java}
> List productList = new ArrayList();
> ...
> String ids = "";
> int i = 0;
> for (Product p : productList) {
> if (i != 0) {
> ids += ",";
> }
> ids += p.id;
> i++;
> }
> String sql = "UPDATE product SET published=1 WHERE id IN (" + list + ")";
> execUpdate(sql);{code}
> Fixed version :
> {code:java}
> List productList = new ArrayList();
> ...
> String ids = StringUtils.join(productList, ',', p -> String.valueOf(p.id))
> String sql = "UPDATE product SET published=1 WHERE id IN (" + list + ")";
> execUpdate(sql);
>  {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (LANG-1594) Support lambda expressions in StringUtils.join

2020-08-10 Thread Kiruahxh (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1594?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kiruahxh updated LANG-1594:
---
Description: 
It would be a nice addition to support lambda expressions in the 
StringUtils.join overloads, they are supported in java 8  so there should not 
be compatibility problems.

This would simplify this kind of code :
{code:java}
List productList = new ArrayList();
...
String ids = "";
int i = 0;
for (Product p : productList) {
if (i != 0) {
ids += ",";
}
ids += p.id;
i++;
}
String sql = "UPDATE product SET published=1 WHERE id IN (" + list + ")";
execUpdate(sql);{code}
Fixed version :
{code:java}
List productList = new ArrayList();
...
String ids = StringUtils.join(productList, ',', p -> String.valueOf(p.id))
String sql = "UPDATE product SET published=1 WHERE id IN (" + list + ")";
execUpdate(sql);
 {code}

  was:
It would be a nice addition to support lambda expressions in the 
StringUtils.join overloads, they are supported in java 8  so there should not 
be compatibility problems.

This would simplify this kind of code : 
{code:java}
List listProduct = new ArrayList();
...
String list = "";
int i = 0;
for (ProductOutput p : listProduct) {
if (i != 0) {
list += ",";
}
list += p.id;
i++;
}
sql = "UPDATE xxx SET toto='tata' WHERE id IN (" + list + ")";
execUpdate(sql);{code}
Fixed version : 
{code:java}
List listProduct = new ArrayList();
...
String list = StringUtils.join(listProduct, ',', p -> String.valueOf(p.id))
sql = "UPDATE xxx SET toto='tata' WHERE id IN (" + list + ")";
execUpdate(sql);
{code}
 

 

 


> Support lambda expressions in StringUtils.join
> --
>
> Key: LANG-1594
> URL: https://issues.apache.org/jira/browse/LANG-1594
> Project: Commons Lang
>  Issue Type: Improvement
>  Components: lang.*
>Affects Versions: 3.11
>Reporter: Kiruahxh
>Priority: Minor
>
> It would be a nice addition to support lambda expressions in the 
> StringUtils.join overloads, they are supported in java 8  so there should not 
> be compatibility problems.
> This would simplify this kind of code :
> {code:java}
> List productList = new ArrayList();
> ...
> String ids = "";
> int i = 0;
> for (Product p : productList) {
> if (i != 0) {
> ids += ",";
> }
> ids += p.id;
> i++;
> }
> String sql = "UPDATE product SET published=1 WHERE id IN (" + list + ")";
> execUpdate(sql);{code}
> Fixed version :
> {code:java}
> List productList = new ArrayList();
> ...
> String ids = StringUtils.join(productList, ',', p -> String.valueOf(p.id))
> String sql = "UPDATE product SET published=1 WHERE id IN (" + list + ")";
> execUpdate(sql);
>  {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Created] (LANG-1594) Support lambda expressions in StringUtils.join

2020-08-10 Thread Kiruahxh (Jira)
Kiruahxh created LANG-1594:
--

 Summary: Support lambda expressions in StringUtils.join
 Key: LANG-1594
 URL: https://issues.apache.org/jira/browse/LANG-1594
 Project: Commons Lang
  Issue Type: Improvement
  Components: lang.*
Affects Versions: 3.11
Reporter: Kiruahxh


It would be a nice addition to support lambda expressions in the 
StringUtils.join overloads, they are supported in java 8  so there should not 
be compatibility problems.

This would simplify this kind of code : 
{code:java}
List listProduct = new ArrayList();
...
String list = "";
int i = 0;
for (ProductOutput p : listProduct) {
if (i != 0) {
list += ",";
}
list += p.id;
i++;
}
sql = "UPDATE xxx SET toto='tata' WHERE id IN (" + list + ")";
execUpdate(sql);{code}
Fixed version : 
{code:java}
List listProduct = new ArrayList();
...
String list = StringUtils.join(listProduct, ',', p -> String.valueOf(p.id))
sql = "UPDATE xxx SET toto='tata' WHERE id IN (" + list + ")";
execUpdate(sql);
{code}
 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2020-08-03 Thread Kiruahxh (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kiruahxh updated LANG-1593:
---
Description: 
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}
 

  was:
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 addresses 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}
 


> 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
>
> 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] [Updated] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2020-08-03 Thread Kiruahxh (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kiruahxh updated LANG-1593:
---
Description: 
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 addresses 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}
 

  was:
For now, join(int[], char) is working well.
 However, the same join method called with a string delimiter behaves 
differently : it returns memory addresses which is rarely 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.4.jar" jshell 
|  Welcome to JShell -- Version 11.0.8
|  For an introduction type: /help intro

jshell> /env -class-path commons-lang3-3.4.jar
|  Setting new options and restoring state.
jshell> import org.apache.commons.lang3.StringUtils;jshell>

int[] arr = new int[] {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}
 


> 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
>
> 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 addresses 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] [Updated] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2020-08-03 Thread Kiruahxh (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kiruahxh updated LANG-1593:
---
Affects Version/s: 3.11

> 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
>
> For now, join(int[], char) is working well.
>  However, the same join method called with a string delimiter behaves 
> differently : it returns memory addresses which is rarely 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.4.jar" jshell 
> |  Welcome to JShell -- Version 11.0.8
> |  For an introduction type: /help intro
> jshell> /env -class-path commons-lang3-3.4.jar
> |  Setting new options and restoring state.
> jshell> import org.apache.commons.lang3.StringUtils;jshell>
> int[] arr = new int[] {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] [Updated] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2020-08-03 Thread Kiruahxh (Jira)


 [ 
https://issues.apache.org/jira/browse/LANG-1593?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kiruahxh updated LANG-1593:
---
Description: 
For now, join(int[], char) is working well.
 However, the same join method called with a string delimiter behaves 
differently : it returns memory addresses which is rarely 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.4.jar" jshell 
|  Welcome to JShell -- Version 11.0.8
|  For an introduction type: /help intro

jshell> /env -class-path commons-lang3-3.4.jar
|  Setting new options and restoring state.
jshell> import org.apache.commons.lang3.StringUtils;jshell>

int[] arr = new int[] {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}
 

  was:
For now, join(int[], char) is working well.
However, the same join method called with a string delimiter behaves 
differently : it returns memory addresses which is rarely the desired behavior.
I think that, for coherence, calling StringUtils with a char or String 
delimiter should return the exact same value.


> 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
>Reporter: Kiruahxh
>Priority: Minor
>
> For now, join(int[], char) is working well.
>  However, the same join method called with a string delimiter behaves 
> differently : it returns memory addresses which is rarely 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.4.jar" jshell 
> |  Welcome to JShell -- Version 11.0.8
> |  For an introduction type: /help intro
> jshell> /env -class-path commons-lang3-3.4.jar
> |  Setting new options and restoring state.
> jshell> import org.apache.commons.lang3.StringUtils;jshell>
> int[] arr = new int[] {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] [Created] (LANG-1593) Common behaviour for StringUtils join APIs when called with char or String delimiter

2020-08-03 Thread Kiruahxh (Jira)
Kiruahxh created LANG-1593:
--

 Summary: 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
Reporter: Kiruahxh


For now, join(int[], char) is working well.
However, the same join method called with a string delimiter behaves 
differently : it returns memory addresses which is rarely the desired behavior.
I think that, for coherence, calling StringUtils with a char or String 
delimiter should return the exact same value.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)