WITH statement in Java
java, syntactic-sugar, syntax, vb.net
Solution
No. The best you can do, when the expression is overly long, is to assign it to a local variable with a short name, and use `{...}` to create a scope:
{
TypeOfFoo it = foo; // foo could be any lengthy expression
it.bar();
it.reset(true);
myvar = it.getName();
}
Problem
In VB.NET there is the WITH command that lets you omit an object name and only access the methods and properties needed. For example: ``` With foo .bar() .reset(true) myVar = .getName() End With ``` Is there any such syntax within Java? Thanks!