I have a series of points with lengths and rotations like this:

I need to create separate chains from points whose lines overlap but I’m having real trouble doing this efficiently.
I have an array of simple Point objects, in no particular order, and I can loop through them and test them with a simple "intersect" function. I need to end up with an array of chains, each with an ordered list of points. (Or another way of representing the chains).
At the moment every avenue I explore seems to involve a convoluted hack of arrays, nudges and fudges. Having never studied Computer Science I wonder if there is some sort of data structure or technique that would lend itself well to this sort of thing.
Could anyone point me in the right direction to achieving this? Pseudocode is fine (or indeed any language), although I am coding in Processing/Java if that helps.
Many thanks,
Josh