如何在嵌套数据中创建顶级数组

时间:2019-01-17 00:07:52

标签: arrays object filter nested

我有一个具有父/子关系的对象数组:

implementation "com.google.firebase:firebase-perf:12.0.1"
implementation "com.google.android.gms:play-services-ads:12.0.1"
implementation "com.google.firebase:firebase-messaging:12.0.1"
implementation "com.google.firebase:firebase-config:12.0.1"
implementation "com.google.firebase:firebase-invites:12.0.1"
implementation "com.google.firebase:firebase-core:12.0.1"
implementation "com.crashlytics.sdk.android:crashlytics:2.9.5"
implementation "com.google.firebase:firebase-ml-vision:18.0.2"

在这些父/子关系中,有些具有多级关系:

Rickard> Eddard> Sansa

Tywin> Jaime> Myrcella

如何遍历数据并仅生成顶级父母(即Rickard和Tywin)的数组?

0 个答案:

没有答案