scala--簡潔優雅的樹定義

也許還不夠優雅。   trait Tree[+T] { /** * 深度優先遍歷 */ def dfs(func: T => Unit) { this match { case Empty => case Node(value, left, right) => func(value);
相關文章
相關標籤/搜索