this should be:  result.iterator.asScala.view.map(castElement)