You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{code}val aScalaSet = Set(1,2,3)
val wrappedSet = new SetWrapper(aScalaSet)
aScalaSet.contains(2) // operation in O(1)
wrappedSet.contains(2) // operation in O(n){code}
Since SetWrapper is not implementing additional methods in top of {code}size(){code} and {code}iterator(){code}, the performance of the wrapped collection is hindered. There are at least 2 issues with that:
Neither the wrap semantic or the documentation is indicating this behavior degradation, leaving the user with false assumptions
It obviously kill performance when working with large collections
This problem might as well be present in other type of collections.
Suggested resolution: make SetWrapper implements all the java interface set methods that would incur in a loss of performance.
The text was updated successfully, but these errors were encountered:
{code}val aScalaSet = Set(1,2,3)
val wrappedSet = new SetWrapper(aScalaSet)
aScalaSet.contains(2) // operation in O(1)
wrappedSet.contains(2) // operation in O(n){code}
Since SetWrapper is not implementing additional methods in top of {code}size(){code} and {code}iterator(){code}, the performance of the wrapped collection is hindered. There are at least 2 issues with that:
This problem might as well be present in other type of collections.
Suggested resolution: make SetWrapper implements all the java interface set methods that would incur in a loss of performance.
The text was updated successfully, but these errors were encountered: