We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4517f1 commit 10463e1Copy full SHA for 10463e1
java/kotlin-extractor/src/main/kotlin/utils/List.kt
@@ -0,0 +1,13 @@
1
+package com.github.codeql
2
+
3
+/**
4
+ * Turns this list of nullable elements into a list of non-nullable
5
+ * elements if they are all non-null, or returns null otherwise.
6
+ */
7
+public fun <T : Any> List<T?>.requireNoNullsOrNull(): List<T>? {
8
+ try {
9
+ return this.requireNoNulls()
10
+ } catch (e: IllegalArgumentException) {
11
+ return null;
12
+ }
13
+}
0 commit comments