I have 2 arrays (batsmen and bowlers). Whats the best way to find the intersection of these and create the allrounders array?
public type Player record {
int id;
string name;
};
Player[] batsmen = [
{id: 1, name: "Virat"},
{id: 2, name: "Rohit"},
{id: 3, name: "Jadeja"}
];
Player[] bowlers = [
{id: 3, name: "Jadeja"},
{id: 4, name: "Bumrah"},
{id: 5, name: "Shami"}
];
Player[] allrounders = [];
You can find more details on
joinin here https://ballerina.io/learn/by-example/outer-join-clause/