cast<R> abstract method
override
Provides a view of this set as a set ofR instances.
If this set contains only instances ofR, all read operationswill work correctly. If any operation tries to access an elementthat is not an instance ofR, the access will throw instead.
Elements added to the set (e.g., by usingadd oraddAll)must be instances ofR to be valid arguments to the adding function,and they must be instances ofE as well to be accepted bythis set as well.
Methods which accept one or moreObject? as argument,likecontains,remove andremoveAll,will pass the argument directly to the this set's methodwithout any checks.That means that you can dosetOfStrings.cast<int>().remove("a")successfully, even if it looks like it shouldn't have any effect.
Implementation
Set<R> cast<R>();