I recently ran into this problem and I want to see the most suitable solution.
I have 2 objects, A and B, B can contain multiple A's, and I want it to be able to get them from each other, i.e: A.getB(); and B.getAs();
What would be the best way to do this? I had thought of doing something like this:
for (A a : aList) {
a.getB().addA(a);
}
Therefore, calling a.getB().getAs().contains(a); would return true
Thanks in advance.