@Override
  protected PendingTransaction getLeastPriorityTransaction() {
    final var lastStatic =
        prioritizedTransactionsStaticRange.isEmpty()
            ? null
            : prioritizedTransactionsStaticRange.last();
    final var lastDynamic =
        prioritizedTransactionsDynamicRange.isEmpty()
            ? null
            : prioritizedTransactionsDynamicRange.last();

    if (lastDynamic == null) {
      return lastStatic;
    }
    if (lastStatic == null) {
      return lastDynamic;
    }

    final Comparator<PendingTransaction> compareByValue =
        Comparator.comparing(
            txInfo ->
                txInfo.getTransaction().getEffectivePriorityFeePerGas(baseFee).getAsBigInteger());

    return compareByValue.compare(lastStatic, lastDynamic) < 0 ? lastStatic : lastDynamic;
  }
See this post for an explainer about these data structures:
https://hackmd.io/@adietrichs/1559-transaction-sorting
ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/transactions/sorter/BaseFeePendingTransactionsSorter.java