clean up code
This commit is contained in:
parent
53fd1f9caa
commit
1bd9799816
@ -25,7 +25,11 @@
|
|||||||
|
|
||||||
package it.norangeb.algorithms.datastructures.dictionary
|
package it.norangeb.algorithms.datastructures.dictionary
|
||||||
|
|
||||||
import arrow.core.*
|
import arrow.core.getOrElse
|
||||||
|
import arrow.core.None
|
||||||
|
import arrow.core.Option
|
||||||
|
import arrow.core.Some
|
||||||
|
import arrow.core.toOption
|
||||||
|
|
||||||
class ImmutableBST<K : Comparable<K>, V> : OrderedDictionary<K, V> {
|
class ImmutableBST<K : Comparable<K>, V> : OrderedDictionary<K, V> {
|
||||||
private var root: Option<Node<K, V>> = None
|
private var root: Option<Node<K, V>> = None
|
||||||
@ -47,7 +51,8 @@ class ImmutableBST<K : Comparable<K>, V> : OrderedDictionary<K, V> {
|
|||||||
|
|
||||||
private fun set(
|
private fun set(
|
||||||
node: Option<Node<K, V>>,
|
node: Option<Node<K, V>>,
|
||||||
key: K, value: V
|
key: K,
|
||||||
|
value: V
|
||||||
): Option<Node<K, V>> = node.fold(
|
): Option<Node<K, V>> = node.fold(
|
||||||
{ Node(key, value) },
|
{ Node(key, value) },
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,6 @@ import org.amshove.kluent.`should be`
|
|||||||
import org.amshove.kluent.shouldEqual
|
import org.amshove.kluent.shouldEqual
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
|
||||||
class ImmutableBSTTest {
|
class ImmutableBSTTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user