Skip to content

Why TraverserContext variables use Class<?> as key? #2721

Answered by bbakerman
qzchenwl asked this question in Q&A
Discussion options

You must be logged in to vote

This was just to keep the API a little tighter. Yes strings are excellent keys but they are also poor keys in the sense of knowing that a CodeRegistry is available as a var say.

So we chose class instead

What if I have more than one variables of the same type?

So create a class and put those many things into that class

class ContainerOfThings {
   List<String,Object> things
}

You will know its your ContainerOfThings class!

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by qzchenwl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants