A question about connecting two circular lists

i have two circular linkes and we need to connect them together
in the place where we found some value in the node
the implemintation is here:
i can get the link where the X value
and the previous to it

but i also need to close links from the other list
tare them and connect them together
i cant see where its been done
in this code
public void insertBefore (Object x,Link link) {
Link p= whereIs(x) ; //a given function that return the node that has X
if (p!=null) {
Link  q=link;
while (q.next !=link)

The Physics Forums Way

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving

Members online