From 499a7c83be4df07ee7c5977e4ca37f31655b7261 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Thu, 31 Aug 2023 17:19:32 +0200 Subject: [PATCH] Minor: Add some nullability annotations --- .../configme/resource/yaml/SnakeYamlNodeContainerImpl.java | 6 +++--- src/main/java/ch/jalu/configme/utils/StreamUtils.java | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/ch/jalu/configme/resource/yaml/SnakeYamlNodeContainerImpl.java b/src/main/java/ch/jalu/configme/resource/yaml/SnakeYamlNodeContainerImpl.java index ad3c9d70..9b2d66b5 100644 --- a/src/main/java/ch/jalu/configme/resource/yaml/SnakeYamlNodeContainerImpl.java +++ b/src/main/java/ch/jalu/configme/resource/yaml/SnakeYamlNodeContainerImpl.java @@ -75,15 +75,15 @@ public void putNode(@NotNull String name, @NotNull Node node) { return mappingNode; } - protected Node createRootNode(List entryNodes) { + protected @NotNull Node createRootNode(@NotNull List entryNodes) { return new MappingNode(Tag.MAP, entryNodes, DumperOptions.FlowStyle.BLOCK); } - protected final List getComments() { + protected final @NotNull List getComments() { return comments; } - protected final Map getValues() { + protected final @NotNull Map getValues() { return values; } } diff --git a/src/main/java/ch/jalu/configme/utils/StreamUtils.java b/src/main/java/ch/jalu/configme/utils/StreamUtils.java index ac902e51..0f20eb8c 100644 --- a/src/main/java/ch/jalu/configme/utils/StreamUtils.java +++ b/src/main/java/ch/jalu/configme/utils/StreamUtils.java @@ -1,5 +1,8 @@ package ch.jalu.configme.utils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + import java.util.stream.IntStream; import java.util.stream.Stream; @@ -19,7 +22,7 @@ private StreamUtils() { * @param element type * @return stream with the element the requested number of times */ - public static Stream repeat(T element, int numberOfTimes) { + public static @NotNull Stream repeat(@Nullable T element, int numberOfTimes) { return IntStream.range(0, numberOfTimes) .mapToObj(i -> element); }