private List<BooleanOptionKey> orderByGroup(final List<? extends BooleanOptionKey> options) {
    final List<String> groupOrder = getGroupOrder(options);
    List<BooleanOptionKey> result = new ArrayList<>(options.size());
    result.addAll(options);
    result.sort((key1, key2) -> {
      String group1 = key1.groupName;
      String group2 = key2.groupName;
      if (group1 == null) {
        return group2 == null ? 0 : 1;
      }
      if (group2 == null) {
        return -1;
      }
      int index1 = groupOrder.indexOf(group1);
      int index2 = groupOrder.indexOf(group2);
      if (index1 == -1 || index2 == -1) return group1.compareToIgnoreCase(group2);
      return Integer.compare(index1, index2);
    });
    return result;
  }
private List<BooleanOptionKey> orderByGroup(final List<? extends BooleanOptionKey> options)