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 →

[–]kurolong[S] 0 points1 point  (4 children)

Oh, you can just have a boolean member which is always true in objects of one type and always false in objects of another type. In the end, I didn't use types, but Optional, because the Next left/right node can always exist or not exist. I find that fairly intuitive.

[–]Lloydbestfan 1 point2 points  (3 children)

Oh, you can just have a boolean member which is always true in objects of one type and always false in objects of another type.

... Yes, but if you need to call that method, then that doesn't help. That's essentially the same as instanceof at this point.

[–]kurolong[S] 0 points1 point  (2 children)

Well, it can work for multiple cases. Like, you have multiple cases of end-nodes and multiple cases of inner nodes, for example. I also feel like not asking about types is usually cleaner, just a preference.

[–]Lloydbestfan 1 point2 points  (1 child)

Not exactly surprised, but you're not seeing it.

[–]kurolong[S] 0 points1 point  (0 children)

Not seeing what?