1
0
Fork 0

nested loop removed

master
cesar 2019-11-23 22:42:45 -03:00 committed by Emily Kager
parent 5b86c403b0
commit 6cda430cdd
1 changed files with 2 additions and 5 deletions

View File

@ -15,9 +15,6 @@ val Context.bookmarkStorage: PlacesBookmarksStorage
* Removes [children] from [BookmarkNode.children] and returns the new modified [BookmarkNode].
*/
operator fun BookmarkNode.minus(children: Set<BookmarkNode>): BookmarkNode {
return this.copy(children = this.children?.filter { filtered ->
children.none {
it.guid == filtered.guid
}
})
val removedChildrenGuids = children.map { it.guid }.toSet()
return this.copy(children = this.children?.filterNot { removedChildrenGuids.contains(it.guid) })
}