clean up code

This commit is contained in:
Raffaele Mignone 2019-04-30 19:55:04 +02:00
parent 53fd1f9caa
commit 1bd9799816
Signed by: norangebit
GPG Key ID: F5255658CB220573
12 changed files with 25 additions and 21 deletions

View File

@ -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) },
{ {

View File

@ -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