Remove manual NPE and replace it with Objects#requireNonNull

This commit is contained in:
Christoph Loy 2020-02-24 12:26:41 +01:00 committed by Niedermann IT-Dienstleistungen
parent b9f041332f
commit b88429a200

View file

@ -3,6 +3,7 @@ package it.niedermann.owncloud.notes.util;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import java.util.HashSet; import java.util.HashSet;
import java.util.Objects;
import java.util.Set; import java.util.Set;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -95,12 +96,8 @@ public class NoteLinksUtils {
* @see String#join(CharSequence, Iterable) * @see String#join(CharSequence, Iterable)
*/ */
private static String join(CharSequence delimiter, Iterable<String> elements) { private static String join(CharSequence delimiter, Iterable<String> elements) {
if (delimiter == null) { Objects.requireNonNull(delimiter);
throw new NullPointerException("Parameter delimiter must not be null"); Objects.requireNonNull(elements);
}
if (elements == null) {
throw new NullPointerException("Parameter elements must not be bull");
}
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
for (String item : elements) { for (String item : elements) {