Returns a shallow copy from this set of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
Returns a shallow copy from this set of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.For hash sets cloning from the beginning or the end of the set has a time complexity of O(M) with M being the number of elements cloned, while cloning from a random position in the middle of the set has a time complexity of O(N) with N being the number of elements in the set.
For tree sets cloning from the beginning or the end of the set has a time complexity of O(M * Log N), while cloning from a random position in the middle of the set has a time complexity of O(N * Log N) with N being the number of elements in the set and with M being the number of elements cloned.
This method has a memory complexity of O(M), with M being the number of elements cloned.