Advertisement
Guest User

Untitled

a guest
Jan 19th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.43 KB | None | 0 0
  1.  def isFilterTextExist(filterText : String,data : SItem) : Boolean = {
  2.       def loop(data : Seq[SItem]) : Boolean = {
  3.        data.view.exists(item => if(item.children.isEmpty) item.name.contains(filterText) else loop(item.children))
  4.       }
  5.       data.item.toString.contains(filterText) || loop(data.children)
  6.     }
  7.  
  8.   case class SItem(name: String, children: SItem*)
  9.  
  10.   is this impl is good ? any better solutions than this ..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement