title: Sort a list of objects based on an unknown number of keys
body: <p>I've seen plenty of ways to sort a list of objects that work fine if you know the incoming keys or at least the incoming number of keys.
  Problem is in my case I don't know if the user will send in 1 or 10 keys.</p>
  
  <p>Currently I have a giant switch statements for each number of keys, but obviously that scales terribly. It just chains a bunch of 'thenComparing' together.</p>
  
  <p>I found an example here that looks like it kind of helps but I don't know how to build a stream of comparators.</p>
  
  <p><a href="https://stackoverflow.com/questions/25850008/how-to-chain-and-apply-a-stream-of-comparators">How-to chain and apply a stream of comparators?</a></p>
  
  <p>Looking for a link or really anything pieces of information that will fill in the gaps on how to do this.</p>
  
  <p>This all works from a user calling webservice where they would call it like</p>
  
  <pre><code>https://host.com/path?sort=[{"attribute1": "ASC"}, {"attribute2": "DESC"}]
  </code></pre>