How to use sortable Sets in Scala (SortedSet, TreeSet, LinkedHashSet) alvin June 6, 2015 - 3:49pm

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 11.28, “How to Use Sortable Sets in Scala”


You want to be able to store and retrieve items from a set in a sorted order.


To retrieve values from a set in sorted order, use a SortedSet. To retrieve elements from a set in the order in which elements were inserted, use a LinkedHashSet.

A SortedSet returns elements in a sorted order:

A Drupal 7 table with sortable headers and pager alvin August 7, 2011 - 9:58pm

In my previous blog post I wrote about how to create an HTML table in a Drupal 7 module form. As promised in that tutorial, once I figured out how to make the table columns sortable, I'd share that secret recipe as well. Here then is how to make an HTML table in a Drupal 7 module/form: