Need guidance in implementing mutually colliding group in java.

I have a table COLLISION which will have info which all experiemnts collide . Each record will have the DB entries as
<Collision ID, exp 1, exp 2>. there won't be another entry like <Collision ID, exp 2, exp 1> for same values. How to implement groups of All experiments that are coliding with each other .
It will be UNION operation and not subset.

record <Collision_ID, exp_1, exp_2>
1.Before adding record to table always partialy sort(exp_1, exp_2)
1a.Check eventualy if(exp_1.equals(exp_2))
2.Check in table ifExist(Collision_ID, exp_1, exp_2)
3.Add record to table if result is false, if true return info "Collision_ID is redundant"
Is need to store in table Collision_ID?
------
n - number of exp
c - number of colliding exp pair
c=(n*n)/2-n
------
quuba

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.