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