This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Suppress("NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS") | |
inline class Result<out T : Any, out E : Any> @PublishedApi internal constructor( | |
@PublishedApi | |
@JvmField | |
internal val value: Any | |
) { | |
companion object { | |
@Suppress("NOTHING_TO_INLINE") | |
inline fun <T : Any, E : Any> Ok(value: T): Result<T, E> = Result(value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
class Node<T : Comparable<T>>( | |
val value: T, | |
val children: MutableSet<Node<T>> = hashSetOf(), | |
val parents: MutableSet<Node<T>> = hashSetOf() | |
) : Comparable<Node<T>> { | |
override fun compareTo(other: Node<T>): Int = this.value.compareTo(other.value) | |
// prevent toString from infinite recursion |