Let's say you have a list of item objects:
public class Item {
String tagOne;
String tagTwo;
}
And you are given a single tag as input and a list of items. Return a list of items contains that tag, and all related tags.
So if you get an input tag = "blue"
And your item list is:
[
item1: {tagOne = "blue", tagTwo = "yellow"},
item2: {tagOne = "pink", tagTwo="red"},
item3: {tagOne = "orange", tagTwo="yellow"},
item4: {tagOne = "green", tagTwo="orange"}
]
You would return a list with {item1, item3, item4}. Because Blue has a relationship with yellow, and yellow has a relationship with orange.