From c5d03ea70ce732e0eabc7ea90b13b8ab95601c07 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 3 Mar 2022 15:15:39 +0300 Subject: Fix *readonly tag --- src/main/java/com/juick/util/TagUtils.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/main/java/com/juick/util') diff --git a/src/main/java/com/juick/util/TagUtils.java b/src/main/java/com/juick/util/TagUtils.java index 2ec03e48..5069ae6f 100644 --- a/src/main/java/com/juick/util/TagUtils.java +++ b/src/main/java/com/juick/util/TagUtils.java @@ -22,6 +22,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.List; +import java.util.Set; import java.util.stream.Collectors; /** @@ -39,4 +40,10 @@ public class TagUtils { return tags.stream().map(t -> "*" + t.getName()) .collect(Collectors.joining(" ")); } + public static boolean hasTag(final Set tags, String name) { + return tags.stream().anyMatch(tag -> tag.getName().equals(name)); + } + public static boolean hasNoTag(final Set tags, String name) { + return tags.stream().noneMatch(tag -> tag.getName().equals(name)); + } } -- cgit v1.2.3