Scala Option 高阶函数代替模式匹配

Scala Option higher order functions instead of pattern matching

下面的高阶函数等价表达式是什么?

def isRepeated:Boolean = {
  prev match {
    case Some(a) => a.prev match {
      case Some(b) => b.equals(this)
      case None => false
    }
    case None => false
  }
}

我认为这是等价的:

def isRepeated:Boolean = prev.exists(_.prev.exists(_.equals(this)))