commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TEXT-93) RandomStringGenerator accepts a list of valid characters
Date Sat, 24 Jun 2017 02:17:00 GMT

    [ https://issues.apache.org/jira/browse/TEXT-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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<Character> list) {
  characterList = new ArrayList<Character>();
  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)

Mime
View raw message