I am a beginner in Java. I have some sample data of nodes:
A -> B
B -> F
C -> R
A -> B
B -> C
R -> C
I have already taken out 2 lists: [A,B,C,A,B,R] and [B,F,R,B,C,C]
However, how should I go about storing the pairs [AB, BF, CR, AB, BC, RC] so that I can find unique pairs? By unique, I mean AB is not equal to BA .
1) So Basically I would like to identify unique pairs.
2) I also want to count the number of times each unique pair has appeared.
EDITED:
3) I am also interested in finding how many different nodes each node connects to.
4) And how many different nodes connect to each node
I am struggling to decide whether I really need to write my own class or is there an easier method?