aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/util
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2022-03-03 15:15:39 +0300
committerGravatar Vitaly Takmazov2022-03-03 15:15:39 +0300
commitc5d03ea70ce732e0eabc7ea90b13b8ab95601c07 (patch)
tree394417ff54f2067d0e9882e80275d3fbc597a959 /src/main/java/com/juick/util
parent5f06a38b6c2a6641900f79c051c1885a935ff9c3 (diff)
Fix *readonly tag
Diffstat (limited to 'src/main/java/com/juick/util')
-rw-r--r--src/main/java/com/juick/util/TagUtils.java7
1 files changed, 7 insertions, 0 deletions
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<Tag> tags, String name) {
+ return tags.stream().anyMatch(tag -> tag.getName().equals(name));
+ }
+ public static boolean hasNoTag(final Set<Tag> tags, String name) {
+ return tags.stream().noneMatch(tag -> tag.getName().equals(name));
+ }
}