From e8867426ad5a7ed0700e37d0117107dd1e1a2ce9 Mon Sep 17 00:00:00 2001 From: Struchkov Mark Date: Tue, 26 Jul 2022 08:44:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B0=D0=B2=D0=B5=D0=BB=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=80=D1=8F=D0=B4=D0=BE=D0=BA=20=D0=B2=20=D1=83=D1=82=D0=B8?= =?UTF-8?q?=D0=BB=D0=B8=D1=82=D0=B0=D1=80=D0=BD=D0=BE=D0=BC=20=D0=BC=D0=BE?= =?UTF-8?q?=D0=B4=D1=83=D0=BB=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- haiti-bom/pom.xml | 4 +- haiti-context/pom.xml | 2 +- haiti-core/pom.xml | 2 +- haiti-exception/pom.xml | 2 +- haiti-filter/pom.xml | 2 +- haiti-utils/pom.xml | 2 +- .../haiti/utils/CollectionUtils.java | 37 +++++++++++++++++++ .../struchkov/haiti/utils/ObjectUtils.java | 24 ------------ .../dev/struchkov/haiti/utils/Parser.java | 8 ++-- pom.xml | 4 +- 10 files changed, 50 insertions(+), 37 deletions(-) create mode 100644 haiti-utils/src/main/java/dev/struchkov/haiti/utils/CollectionUtils.java diff --git a/haiti-bom/pom.xml b/haiti-bom/pom.xml index a7f01c7..52311d5 100644 --- a/haiti-bom/pom.xml +++ b/haiti-bom/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti-bom - 1.1.0 + 1.2.0 pom Haiti BOM @@ -30,7 +30,7 @@ UTF-8 UTF-8 - 1.1.0 + 1.2.0 ${haiti.ver} ${haiti.ver} diff --git a/haiti-context/pom.xml b/haiti-context/pom.xml index 245aea8..e8e5e90 100644 --- a/haiti-context/pom.xml +++ b/haiti-context/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti - 1.1.0 + 1.2.0 haiti-context diff --git a/haiti-core/pom.xml b/haiti-core/pom.xml index d4ab3c6..4f0d2d1 100644 --- a/haiti-core/pom.xml +++ b/haiti-core/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti - 1.1.0 + 1.2.0 haiti-core diff --git a/haiti-exception/pom.xml b/haiti-exception/pom.xml index f14d901..3998d30 100644 --- a/haiti-exception/pom.xml +++ b/haiti-exception/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti - 1.1.0 + 1.2.0 haiti-exception diff --git a/haiti-filter/pom.xml b/haiti-filter/pom.xml index 78ce92e..804968d 100644 --- a/haiti-filter/pom.xml +++ b/haiti-filter/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti - 1.1.0 + 1.2.0 haiti-filter diff --git a/haiti-utils/pom.xml b/haiti-utils/pom.xml index 4d707c0..f29d5eb 100644 --- a/haiti-utils/pom.xml +++ b/haiti-utils/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti - 1.1.0 + 1.2.0 Haiti Utils diff --git a/haiti-utils/src/main/java/dev/struchkov/haiti/utils/CollectionUtils.java b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/CollectionUtils.java new file mode 100644 index 0000000..5de09f1 --- /dev/null +++ b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/CollectionUtils.java @@ -0,0 +1,37 @@ +package dev.struchkov.haiti.utils; + +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static dev.struchkov.haiti.utils.Exceptions.utilityClass; + +public final class CollectionUtils { + + private CollectionUtils() { + utilityClass(); + } + + public static List toList(T... t) { + return Arrays.stream(t).collect(Collectors.toList()); + } + + public static Collection toCollection(T... t) { + return Arrays.stream(t).collect(Collectors.toList()); + } + + public static Collection toCollection(Collection collection, T... t) { + return Stream.concat( + collection.stream(), Arrays.stream(t) + ).collect(Collectors.toList()); + } + + public static Collection toCollection(Collection collectionOne, Collection collectionTwo) { + return Stream.concat( + collectionOne.stream(), collectionTwo.stream() + ).collect(Collectors.toList()); + } + +} diff --git a/haiti-utils/src/main/java/dev/struchkov/haiti/utils/ObjectUtils.java b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/ObjectUtils.java index ab586c6..417c6e6 100644 --- a/haiti-utils/src/main/java/dev/struchkov/haiti/utils/ObjectUtils.java +++ b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/ObjectUtils.java @@ -7,10 +7,6 @@ import java.lang.reflect.Method; import java.math.BigDecimal; import java.math.BigInteger; import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; import static dev.struchkov.haiti.utils.Exceptions.utilityClass; import static dev.struchkov.haiti.utils.Inspector.isNotNull; @@ -145,24 +141,4 @@ public class ObjectUtils { && method.getName().toLowerCase().endsWith(fieldName.toLowerCase()); } - public static List toList(T... t) { - return Arrays.stream(t).collect(Collectors.toList()); - } - - public static Collection toCollect(T... t) { - return Arrays.stream(t).collect(Collectors.toList()); - } - - public static Collection toCollect(Collection collection, T... t) { - return Stream.concat( - collection.stream(), Arrays.stream(t) - ).collect(Collectors.toList()); - } - - public static Collection toCollect(Collection collectionOne, Collection collectionTwo) { - return Stream.concat( - collectionOne.stream(), collectionTwo.stream() - ).collect(Collectors.toList()); - } - } diff --git a/haiti-utils/src/main/java/dev/struchkov/haiti/utils/Parser.java b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/Parser.java index 09922f2..6af7067 100644 --- a/haiti-utils/src/main/java/dev/struchkov/haiti/utils/Parser.java +++ b/haiti-utils/src/main/java/dev/struchkov/haiti/utils/Parser.java @@ -10,7 +10,7 @@ import static dev.struchkov.haiti.utils.Exceptions.utilityClass; public final class Parser { - private static Pattern URL_PARSE; + private static Pattern urlParse; private Parser() { utilityClass(); @@ -29,10 +29,10 @@ public final class Parser { } private static Pattern getUrlParse() { - if (checkNull(URL_PARSE)) { - URL_PARSE = Pattern.compile("(https?://)([^:^/]*)(:\\d*)?(.*)?"); + if (checkNull(urlParse)) { + urlParse = Pattern.compile("(https?://)([^:^/]*)(:\\d*)?(.*)?"); } - return URL_PARSE; + return urlParse; } } diff --git a/pom.xml b/pom.xml index 73138a1..ef96f12 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.struchkov.haiti haiti - 1.1.0 + 1.2.0 pom Haiti Framework @@ -39,7 +39,7 @@ UTF-8 UTF-8 - 1.1.0 + 1.2.0 ${haiti.ver} ${haiti.ver}