Skip to content

Instantly share code, notes, and snippets.

@sheki
Created April 14, 2011 15:00
Show Gist options
  • Save sheki/919651 to your computer and use it in GitHub Desktop.
Save sheki/919651 to your computer and use it in GitHub Desktop.
Attempt at a linklist implementation in scala
case class Node(val data : Int, val next : Option[Node])
{
override def toString(): String = "node "+data
}
def printLinkedList ( node : Option[Node] ) : String ={
node match {
case None =>
case Node(data, next) => data+" "+printLinkedList(next)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment