I have 2 arrays inside another array. Inside these arrays there are objects and I want to group them by the object key.
parent array contains n array
[array_1, array_2]
Like I said, inside these arrays there is also an array filled with objects
array 1
taskTypeList: Array(7)
0: TaskType {Key: 313, Value: "R/I", IsDisabled: true, Duration: 1}
1: TaskType {Key: 312, Value: "MEL", IsDisabled: true, Duration: 2}
2: TaskType {Key: 311, Value: "SGH", IsDisabled: false, Duration: 9}
3: TaskType {Key: 309, Value: "LOC", IsDisabled: true, Duration: 4}
4: TaskType {Key: 485, Value: "TT", IsDisabled: true, Duration: 5}
5: TaskType {Key: 310, Value: "FOT", IsDisabled: true, Duration: 6}
6: TaskType {Key: 314, Value: "TS", IsDisabled: true, Duration: 7}
array 2
taskTypeList: Array(7)
0: TaskType {Key: 313, Value: "R/I", IsDisabled: true, Duration: 1}
1: TaskType {Key: 312, Value: "MEL", IsDisabled: true, Duration: 2}
2: TaskType {Key: 311, Value: "SGH", IsDisabled: true, Duration: 3}
3: TaskType {Key: 309, Value: "LOC", IsDisabled: false, Duration: 6}
4: TaskType {Key: 485, Value: "TT", IsDisabled: true, Duration: 5}
5: TaskType {Key: 310, Value: "FOT", IsDisabled: true, Duration: 6}
6: TaskType {Key: 314, Value: "TS", IsDisabled: true, Duration: 7}
I want to group these arrays by their keys. Result should be like this:
0:
309: [TaskType,TaskType]
310: [TaskType,TaskType]
311: [TaskType,TaskType]
312: [TaskType,TaskType]
313: [TaskType,TaskType]
314: [TaskType,TaskType]
485: [TaskType,TaskType]
How can do this?