public static <T extends Comparable<T>> node_t<T> merge_sorted_linked_lists(
      node_t<T> F, node_t<T> L) {
    Ref<node_t<T>> sorted_head = new Ref<node_t<T>>(null);
    Ref<node_t<T>> tail = new Ref<node_t<T>>(null);
    Ref<node_t<T>> RF = new Ref<node_t<T>>(F);
    Ref<node_t<T>> RL = new Ref<node_t<T>>(L);

    while (RF.value != null && RL.value != null) {
      append_node_and_advance(sorted_head, tail,
          RF.value.data.compareTo(RL.value.data) < 0 ? RF : RL);
    }

    // Append the remaining nodes of F.
    if (RF.value != null) {
      append_node(sorted_head, tail, RF);
    }

    // Append the remaining nodes of L.
    if (RL.value != null) {
      append_node(sorted_head, tail, RL);
    }

    return sorted_head.value;
  }