Search code examples
scaladoubly-linked-list

How to create immutable Doubly LinkedList in Scala?


Can someone help me to create immutable doubly linked list in Scala by showing one of the method implementation? Also, can you provide me one of example of it by let's implementing prepend(element:Int): DoublyLinkedList[Int] ?


Solution

  • Call By Name & lazy val (Call by need) makes it possible to have immutable doubly linked list.