[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-28 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16067594#comment-16067594
 ] 

ASF GitHub Bot commented on TEXT-93:


Github user asfgit closed the pull request at:

https://github.com/apache/commons-text/pull/54


> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>Assignee: Rob Tompkins
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-25 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16062402#comment-16062402
 ] 

ASF GitHub Bot commented on TEXT-93:


Github user ameyjadiye commented on the issue:

https://github.com/apache/commons-text/pull/54
  
As per discussion 
here[TEXT-93](https://issues.apache.org/jira/browse/TEXT-93) we are good to 
merge this PR. 


> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-25 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16062325#comment-16062325
 ] 

Gilles commented on TEXT-93:


It's fine to delay the addition of the overloaded method to when someone has a 
use-case for it...


> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16062008#comment-16062008
 ] 

ASF GitHub Bot commented on TEXT-93:


Github user ameyjadiye commented on a diff in the pull request:

https://github.com/apache/commons-text/pull/54#discussion_r123877950
  
--- Diff: src/main/java/org/apache/commons/text/RandomStringGenerator.java 
---
@@ -76,23 +78,29 @@
 private final TextRandomProvider random;
 
 /**
+ * The source of provided charachters.
+ */
+private final List characterList;
+
+/**
  * Constructs the generator.
- *
- * @param minimumCodePoint
+ *  @param minimumCodePoint
  *smallest allowed code point (inclusive)
  * @param maximumCodePoint
  *largest allowed code point (inclusive)
  * @param inclusivePredicates
- *filters for code points
- * @param random
- *source of randomness
+ *filters for code points
--- End diff --

yeah, seems like IntelliJ did this unknowingly, fixed it!


> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16062006#comment-16062006
 ] 

ASF GitHub Bot commented on TEXT-93:


Github user coveralls commented on the issue:

https://github.com/apache/commons-text/pull/54
  

[![Coverage 
Status](https://:/builds/12116448/badge)](https://:/builds/12116448)

Coverage decreased (-0.02%) to 97.305% when pulling 
**9db77088ecc557c2f209dd36972746d6de8dfc4a on ameyjadiye:TEXT-93** into 
**569dbc09402a6f28334936567a597e3d0db9185c on apache:master**.



> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-24 Thread Bruno P. Kinoshita (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061893#comment-16061893
 ] 

Bruno P. Kinoshita commented on TEXT-93:


>Well, Yes nowadays programmers prefer List over arrays

That can lead to a whole new conversation, and you will probably find people 
supporting List over arrays, and others supporting arrays over Lists :-) I, 
myself, have no preference, normally the libraries/framework kind of dictate 
what I am using...

> and it's convineant too, but I'm not biased towards either decision to have 
> that method or not as far as we have another method to perform task for us

I'm +0 to having the other method. i.e. fine if the method is added, but fine 
too if others prefer not to add it. We can add it later too if that's the case. 
However, looking at classes at o.a.c.text, most I believe operate on 
Character[], char...,char[], etc.

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-24 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061891#comment-16061891
 ] 

ASF GitHub Bot commented on TEXT-93:


Github user kinow commented on a diff in the pull request:

https://github.com/apache/commons-text/pull/54#discussion_r123874569
  
--- Diff: src/main/java/org/apache/commons/text/RandomStringGenerator.java 
---
@@ -76,23 +78,29 @@
 private final TextRandomProvider random;
 
 /**
+ * The source of provided charachters.
+ */
+private final List characterList;
+
+/**
  * Constructs the generator.
- *
- * @param minimumCodePoint
+ *  @param minimumCodePoint
  *smallest allowed code point (inclusive)
  * @param maximumCodePoint
  *largest allowed code point (inclusive)
  * @param inclusivePredicates
- *filters for code points
- * @param random
- *source of randomness
+ *filters for code points
--- End diff --

Indentation got a bit messed up here, and the param entry for 
minimumCodePoint too


> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-24 Thread Amey Jadiye (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061880#comment-16061880
 ] 

Amey Jadiye commented on TEXT-93:
-

Well, Yes nowadays programmers prefer List over arrays and it's convineant too, 
but I'm not biased towards either decision to have that method or not as far as 
we have another method to perform task for us. [~pascalschumacher] and 
[~wmacgyver]  what do you think ?

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-24 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061867#comment-16061867
 ] 

Gilles commented on TEXT-93:


It is not obvious to me that such a method is not useful (and even more so when 
one can pass any {{Collection}})...


> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread Amey Jadiye (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061773#comment-16061773
 ] 

Amey Jadiye commented on TEXT-93:
-

Hi Gilles, 

That method is removed all together as per previous discussion, you are looking 
some past commit., Now we are having only selectFrom method with varargs.

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061745#comment-16061745
 ] 

Gilles commented on TEXT-93:


Code 
[here|https://github.com/apache/commons-text/pull/54/commits/c1aabc0172e86f4f28a0444afebda335d144b039]
 looks suspicious:
# It seems that the argument of the method is modified, not the instance 
variable
# There are unnecessary conversion from {{Character}} to {{char}} and back

How about something like
{code}
public Builder selectFrom(Collection list) {
  characterList = new ArrayList();
  characterList.addAll(list);
  return this;
}
{code}
?



> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread Wilson MacGyver (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061498#comment-16061498
 ] 

Wilson MacGyver commented on TEXT-93:
-

thank you guys for such fast turn around and awesome response

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread Amey Jadiye (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061412#comment-16061412
 ] 

Amey Jadiye commented on TEXT-93:
-

Committed all the changes we discussed  to PR.

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061411#comment-16061411
 ] 

ASF GitHub Bot commented on TEXT-93:


Github user coveralls commented on the issue:

https://github.com/apache/commons-text/pull/54
  

[![Coverage 
Status](https://:/builds/12108852/badge)](https://:/builds/12108852)

Coverage decreased (-0.02%) to 97.305% when pulling 
**df30bf96856287478f3a7dfa7f017ca175bdd352 on ameyjadiye:TEXT-93** into 
**569dbc09402a6f28334936567a597e3d0db9185c on apache:master**.



> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread Wilson MacGyver (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061353#comment-16061353
 ] 

Wilson MacGyver commented on TEXT-93:
-

the primary argument for selectFromList is 

in https://commons.apache.org/proper/commons-lang/javadocs/api-3.6/

Deprecated. 
as of 3.6, use commons-text RandomStringGenerator instead

having selectFromList  reduce user's pain to switch. Because you know what 
happens when you make it hard to switch, people will just keep using the old 
depreciated one

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread Pascal Schumacher (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16061137#comment-16061137
 ] 

Pascal Schumacher commented on TEXT-93:
---

You can pass a char array to a char... vararg method, so an overload is not 
necessary. Imho selectFromList won't be commons usecase and can be dropped.

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread Amey Jadiye (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16060473#comment-16060473
 ] 

Amey Jadiye commented on TEXT-93:
-

Agreed with name change.
For suggested varargs we should have one more overloaded method so there will 
be total below 3 methods

{code}
selectFromList(List)
selectFrom(char[])
selectFrom(Character ... )
{code}

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-23 Thread Pascal Schumacher (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16060454#comment-16060454
 ] 

Pascal Schumacher commented on TEXT-93:
---

I prefer selectFrom as method name (as suggested by [~wmacgyver]) and varargs 
as parameter type. That would make the api very convenient to use:

{code}
RandomStringGenerator gen = new RandomStringGenerator.Builder().selectFrom('a', 
'b', '1', '2').build();
{code}

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16060441#comment-16060441
 ] 

ASF GitHub Bot commented on TEXT-93:


Github user coveralls commented on the issue:

https://github.com/apache/commons-text/pull/54
  

[![Coverage 
Status](https://:/builds/12097991/badge)](https://:/builds/12097991)

Coverage decreased (-0.02%) to 97.308% when pulling 
**f9177e204d608e7fa708d57fabf0029746f7774a on ameyjadiye:TEXT-93** into 
**569dbc09402a6f28334936567a597e3d0db9185c on apache:master**.



> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-22 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16060069#comment-16060069
 ] 

Gilles commented on TEXT-93:


Amey,

Referring to the PR; this code
{code}
public Builder selectFromList(List characterList) {
this.characterList = characterList;
return this;
}
{code}
is unsafe; better make a defensive copy (like for the {{char[]}} version).


> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16060044#comment-16060044
 ] 

ASF GitHub Bot commented on TEXT-93:


Github user coveralls commented on the issue:

https://github.com/apache/commons-text/pull/54
  

[![Coverage 
Status](https://:/builds/12093960/badge)](https://:/builds/12093960)

Coverage decreased (-0.02%) to 97.306% when pulling 
**2dfadf4f8b51ae65d1b1b1f17afa3387b908c31f on ameyjadiye:TEXT-93** into 
**569dbc09402a6f28334936567a597e3d0db9185c on apache:master**.



> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-22 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16060026#comment-16060026
 ] 

ASF GitHub Bot commented on TEXT-93:


GitHub user ameyjadiye opened a pull request:

https://github.com/apache/commons-text/pull/54

TEXT-93: RandomStringGenerator accepts a list of valid characters

Added selectFrom feature : 
```
selectFromList(char[] chars)
selectFromList(List charList)
```

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ameyjadiye/commons-text TEXT-93

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-text/pull/54.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #54


commit 278f1e0fb553fc2d2d6f5563d9e61899776cd80d
Author: Amey Jadiye 
Date:   2017-06-22T21:18:11Z

TEXT-93: RandomStringGenerator accepts a list of valid characters




> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-22 Thread Pascal Schumacher (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16059851#comment-16059851
 ] 

Pascal Schumacher commented on TEXT-93:
---

I'm not opposed to adding a new method to make it easier.

I may be wrong, but I believe [~dmjones500] added 
RandomStringGenerator#filteredBy for this use cases like this. I agree that is 
a bit cumbersome to use (especially on java 7). (It's easier if you use the 
build-in CharacterPredicate of the CharacterPredicates class.)





> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-22 Thread Amey Jadiye (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16059748#comment-16059748
 ] 

Amey Jadiye commented on TEXT-93:
-

Hi [~pascalschumacher]

Though your code is generating expected output this seems workaround to achieve 
Random String from given characters and user have to do lot of work himself. 
I'm in favour of having simple API given by [~erans] to which I can pass char 
array or char list and it will return Random String. what do you think ?

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-22 Thread Pascal Schumacher (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16059728#comment-16059728
 ] 

Pascal Schumacher commented on TEXT-93:
---

Thanks for the suggestion.

There is a bit of overlap with RandomStringGenerator#filteredBy.

With some work you can already archive this today, e.g.

{code}
Set characters = Stream.of('a', 'b', 'c').map(i -> (int) 
i).collect(Collectors.toSet());
String str = new RandomStringGenerator.Builder().filteredBy(i -> 
characters.contains(i)).build().generate(5);{code}

> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters

2017-06-21 Thread Gilles (JIRA)

[ 
https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16058503#comment-16058503
 ] 

Gilles commented on TEXT-93:


We could have
* {{selectFromList(char[])}}
* {{selectFromList(List)}}


> RandomStringGenerator accepts a list of valid characters
> 
>
> Key: TEXT-93
> URL: https://issues.apache.org/jira/browse/TEXT-93
> Project: Commons Text
>  Issue Type: Wish
>Reporter: Wilson MacGyver
>
>  implement a "selectFrom" feature:
>   RandomStringGenerator gen = new RandomStringGenerator.Builder()
> .selectFrom(charArray)
> .build();
> so we can pass a list of valid characters



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)