Converting a Set into a Range Statement and Vice Versa.
I have a Set S=[1,2,3,4,5,10,12]
Now I want to convert this Set into a Range Statement which is of Form as follows...
Desired Range Statement Form is = 1..5\/10\/12.
Since 1 to 5 are contigious in my Set, they are represented as 1..5 and 10 and 12 are single non contigious elements they are given a single element with a union (\/) Symbol.
Similarly, I want to convert the RangeStatement 1..5\/10\/12 to Set S=[1,2,3,4,5,10,12].
DO we have any efficient method to o this in Java?
if I need to write my own method or is there any inbuilt method to do this.
Re: Converting a Set into a Range Statement and Vice Versa.
There isn't a built in method for that. You'll need to write your own method.