commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <pmoua...@apache.org>
Subject commons-lang3: Too early to deprecate RandomStringUtils in favor of RandomStringGenerator ?
Date Sun, 03 Sep 2017 12:56:22 GMT
Hello,
Since version 3.6 of commons-lang3, RandomStringUtils has been deprecated
following introduction of commons-text.

Looking at current 1.1 version (and even snapshot 1.2) I wonder if it's not
too early for deprecation.

RandomStringUtils was very simple and intuitive to use. I don't remember I
ever had to think when using it :-)

RandomStringGenerator is nice in terms of API and much more powerful for
advanced usage, but it looks to me much more complex to use for simple,
average cases:

   - RandomStringUtils.random ? => Is this the equivalent
   - new RandomStringGenerator.Builder()
                  .filteredBy(CharacterPredicates.LETTERS)
                  .build();
      - I don't get exactly the same results ? Is it due to Unicode chars ?
      - RandomStringUtils.randomAlphabetic(count) => new
   RandomStringGenerator.Builder()
               .withinRange('0', 'z')
               .filteredBy(CharacterPredicates.LETTERS,
   CharacterPredicates.DIGITS)
               .build().generate(count)

What about use cases when count and source chars are configurable :

   - RandomStringUtils.random(count, chars)
   - => Are we supposed to build each time the generator ?

Is it as efficient in terms of CPU and memory usage as RandomStringUtils
equivalent ?

Sorry if my questions are stupid.

Thanks

Regards

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message