Not sure how often this is called, but this implementation is kind of inefficient. It creates lots of pair objects. It's better to just write the code to do it (`if (a.srcId != b.srcId) a.srcId - b.srcId else a.dstId - b.dstId`)