Java get variable by string

Bigbacon

Fully [H]
Joined
Jul 12, 2007
Messages
21,352
I am not a java person so I am trying to figure this out.

I want to be able to get an object by using a string to get it.

I may not be explaining that well so I'll try to explain the only way I know how.

So in VB.net you can do something like

Dim b as textbox = form1.findControl(String) C# has a similar thing as well.

Is there a java equivalent to this?
 
You could always use a hashmap

Map<String, MyType> foo = new HashMap<String, MyType>();

foo.put("blah", new MyType());

later..

MyType something = foo.get("blah");
 
Back
Top