我对以下问题感兴趣:Collections.reverse() 与 Lists.reverse() 哪个更快?
最佳答案
他们做不同的事情。
Collections.reverse
采用可变列表并反转其顺序。它需要线性时间。它必须。
Guava 的 Lists.reverse
返回反转列表的 View 。它会在恒定时间内返回,但您将为每个操作支付 View 的(小)开销。
关于java - Collections.reverse() vs Lists.reverse() 哪个更快?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26285155/