Skip to content

Commit eade3af

Browse files
return trivial value for deprecated methods of the NonEmptyCollection interface
1 parent 9d50ad3 commit eade3af

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/commonMain/kotlin/com/quickbirdstudios/nonEmptyCollection/NonEmptyCollection.kt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ interface NonEmptyCollection<T> : Collection<T> {
77
message = "Is never null!",
88
replaceWith = ReplaceWith("first()")
99
)
10-
fun firstOrNull(): T? = throw NotImplementedError()
10+
fun firstOrNull(): T = first()
1111

1212
@Deprecated(
1313
level = DeprecationLevel.ERROR,
1414
message = "Alternative is never used!",
1515
replaceWith = ReplaceWith("first()")
1616
)
17-
fun firstOr(alternative: () -> T): T = throw NotImplementedError()
18-
19-
@Deprecated(
20-
level = DeprecationLevel.ERROR,
21-
message = "Alternative is never used!",
22-
replaceWith = ReplaceWith("")
23-
)
24-
fun <R> ifEmpty(defaultValue: () -> R): R = throw NotImplementedError()
17+
fun firstOr(alternative: () -> T): T = first()
2518
}

0 commit comments

Comments
 (0)