This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git


The following commit(s) were added to refs/heads/master by this push:
     new e79f79a1 Internal refactoring
e79f79a1 is described below

commit e79f79a14f8628c744d32324063a21a8d8ef851a
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Tue May 20 13:19:57 2025 -0400

    Internal refactoring
---
 .../org/apache/commons/text/RandomStringGenerator.java  | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/text/RandomStringGenerator.java 
b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
index 00854dd3..ff2f3718 100644
--- a/src/main/java/org/apache/commons/text/RandomStringGenerator.java
+++ b/src/main/java/org/apache/commons/text/RandomStringGenerator.java
@@ -181,8 +181,7 @@ public final class RandomStringGenerator {
          */
         @Override
         public RandomStringGenerator get() {
-            return new RandomStringGenerator(minimumCodePoint, 
maximumCodePoint, inclusivePredicates,
-                    random, characterList);
+            return new RandomStringGenerator(this);
         }
 
         /**
@@ -390,14 +389,12 @@ public final class RandomStringGenerator {
      *            source of randomness
      * @param characterList list of predefined set of characters.
      */
-    private RandomStringGenerator(final int minimumCodePoint, final int 
maximumCodePoint,
-                                  final Set<CharacterPredicate> 
inclusivePredicates, final IntUnaryOperator random,
-                                  final List<Character> characterList) {
-        this.minimumCodePoint = minimumCodePoint;
-        this.maximumCodePoint = maximumCodePoint;
-        this.inclusivePredicates = inclusivePredicates;
-        this.random = random;
-        this.characterList = characterList;
+    private RandomStringGenerator(final Builder builder) {
+        this.minimumCodePoint = builder.minimumCodePoint;
+        this.maximumCodePoint = builder.maximumCodePoint;
+        this.inclusivePredicates = builder.inclusivePredicates;
+        this.random = builder.random;
+        this.characterList = builder.characterList;
     }
 
     /**

Reply via email to