How do you type cast the returned value of a method so that you can avoid creating a temporary variable. Here's an example:
I know that the component returned by panel.getComponent(i) will be of type OnOffButton. I want to avoid:
OnOffButton btn = (OnOffButton) panel.getComponent(i); btn.setState('0');
Is there a way around this?
You may try following code:
((OnOffButton) panel.getComponent(i); btn.setState('0')).setState('0');
That doesn't work. (Also, i'm trying to avoid creating the btn variable in the first place).