void () { if(2 * mySize < mySetLength && mySetLength > 5) { int positivePosition = -1; for(int i = 0; i < mySetLength; ++i) { if (mySet[i] < 0) { while(i < mySetLength && mySet[i] < 0) ++i; if (i == mySetLength) { break; } else { mySet[++positivePosition] = mySet[i]; } } else { ++positivePosition; if (i != positivePosition) mySet[positivePosition] = mySet[i]; } } // todo slightly decrease size mySetLength = (short)(positivePosition + 1); } }