I have to optimize Java Vector with "class Row_i" - objects (see below), which describes two series(A and B) of number ranges (startPos - endPos) are equal in every row. This vector has to be sorted and optimized.
Group/Sort Criterias:
1 - Row grouping by id_A,
2 - Row grouping by id_B,
3 - Row grouping by startPosA,
4 - Row grouping by startPosB,
So after sorting have to remove redundant rows.
Redundant rows:
1. if startPosA(i+1) value is the next number startPosA(i) value
Row-Optimizing should happend only if PosB meet same criteria.
Vector not Sorted: ..................................
id_A id_B sPosA - ePosA sPosA - ePosA
2392 ++ 4061 ++ 3158 - 3163 ++ 13222 - 13227;
1192 ++ 2064 ++ 287 - 290 ++ 257 - 260;
2392 ++ 1063 ++ 480 - 590 ++ 1950 - 1960;
1092 ++ 1555 ++ 7385 - 7395 ++ 193 - 203;
1192 ++ 2064 ++ 273 - 286 ++ 243 - 256;
1192 ++ 2064 ++ 291 - 294 ++ 261 - 264;
Vector sorted and optimized
1092 ++ 1555 ++ 7385 - 7395 ++ 193 - 203;
1192 ++ 2064 ++ 273 - 294 ++ 243 - 264;
2392 ++ 1063 ++ 480 - 590 ++ 1950 - 1960;
2392 ++ 4061 ++ 3158 - 3163 ++ 13222 - 13227
.........................
Depends of implementation collection-size vary. And is in one case 200 - 5000 objects Has anybody idea how to solve this, i efficient way.
I would be gratefull for any help.
Entire classes in Java here:
Objects - class "Row_i" -> http://pastebin.com/wc3ytUqf,
@Missing Faktor: Thank you for the hint!!