title: How to create SortedSet (e.g. TreeSet) for elements of type BitSet
body: <p>I have a number <code>(power(2,k))</code> of BitSet objects and I want to store them in a <code>SortedSet</code>. I use the code:</p>
  
  <pre><code>Set &lt;BitSet&gt; S= new TreeSet&lt;&gt;();
  </code></pre>
  
  <p>However, I am getting this error: <code>java.lang.ClassCastException: java.util.BitSet cannot be cast to java.lang.Comparable</code></p>
  
  <p>How do I implement comparable interface? Or is there any other way to sort these elements of type <code>BitSet</code>?</p>