code: public static List<EncodedPair> sortByNameAndValues(List<? extends EncodedPair> pairs){
         List<EncodedPair> sorted = new ArrayList<EncodedPair>(pairs);
         Collections.sort(sorted, PAIR_NAME_VALUE_COMPARATOR);
         return sorted;
      }
docs: <p>Sort the given list of encoded pairs by name and by values.</p>
  <p>Does not alter the provided list.</p>
  @param pairs list of encoded pair objects to order by
  @return ordered list of encoded pair objects