commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Tsvetkov (JIRA)" <>
Subject [jira] [Created] (LANG-1412) Add toArray method to CharSet
Date Wed, 15 Aug 2018 09:05:00 GMT
Alexander Tsvetkov created LANG-1412:

             Summary: Add toArray method to CharSet
                 Key: LANG-1412
             Project: Commons Lang
          Issue Type: New Feature
            Reporter: Alexander Tsvetkov

We have a project where we generate a random string from a set of legal characters like this:
StringBuilder stringBuilder = new StringBuilder(length);
for (int i = 0; i < length; i++) {
    int randomIndex = randomGenerator.nextInt(LEGAL_CHARACTERS.length);
return stringBuilder.toString();
Where LEGAL_CHARACTERS is a char array. The problem is that initializing the LEGAL_CHARACTERS
array is not very pretty and we would like to do it this way:
private static final char[] LEGAL_CHARACTERS = CharSet.getInstance("A-Z", "a-z", "0-9", "-",
Do you think this would be a good addition to Commons Lang in general? If yes, then is CharSet
the right place for that?

This message was sent by Atlassian JIRA

View raw message