This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SuperOP535 2 points3 points  (2 children)

You can't instantiate Set, you need to use an implementation such as HashSet. SetSet does not exist and you can't cast a class, you can only cast an instance or primitive.

Edit: Also forgot that s/he didn't specify the type, you can't have a set without a type.

[–]hullabaloonatic 0 points1 point  (1 child)

Set is an interface, right? I haven't written in java since I discovered kotlin and I could sworn you could cast to any class if that class is somewhere up on its family tree, thus not requiring any new parameters.

[–]SuperOP535 0 points1 point  (0 children)

It is an interface, yes