Swift平面地图字典数据结构

时间:2016-11-17 20:42:10

标签: swift

我正在尝试将字典映射到其值的扁平数组。将此对象转换为[Object]

var objectsDic: [Int : [[Object]]]

我终于找到了一种有效的方法

objectsDic.map { $0.value }.flatMap { $0 }.flatMap { $0 }

有没有更好的方法可以在不使用两个单独的平面地图调用的情况下执行此操作?谢谢!

1 个答案:

答案 0 :(得分:1)

评论中的一些建议的混合,我相信最简洁的符号:

/usr/local/lib/python2.7/dist-packages/sklearn/base.py:315: UserWarning: Trying to unpickle estimator TfidfTransformer from version 0.18 when using version 0.18.1. This might lead to breaking code or invalid results. Use at your own risk.
  UserWarning)
/usr/local/lib/python2.7/dist-packages/sklearn/base.py:315: UserWarning: Trying to unpickle estimator TfidfVectorizer from version 0.18 when using version 0.18.1. This might lead to breaking code or invalid results. Use at your own risk.
  UserWarning)