From 8cd399d2e9ce0295de6cbc1a98490be93b4dff0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Przemek=20Draga=C5=84czuk?= Date: Sun, 16 Feb 2020 15:58:37 +0100 Subject: [PATCH] Now only lowercase letters and numbers are generated --- src/main/java/tk/draganczuk/url/Utils.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/tk/draganczuk/url/Utils.java b/src/main/java/tk/draganczuk/url/Utils.java index 0c868c4..efa312a 100644 --- a/src/main/java/tk/draganczuk/url/Utils.java +++ b/src/main/java/tk/draganczuk/url/Utils.java @@ -10,14 +10,12 @@ public class Utils { int rightLimit = 122; // letter 'z' int targetStringLength = 10; - String generatedString = random.ints(leftLimit, rightLimit + 1) - .filter(i -> (i <= 57 || i >= 65) && (i <= 90 || i >= 97)) + return random.ints(leftLimit, rightLimit + 1) + .filter(i -> (i <= 57 || i >= 97)) .limit(targetStringLength) .collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append) .toString(); - - return generatedString; } }