Java Equivalent to VB With
With is considered by some to be poor
programming practice because it obscures the contained code purely
for the benefit of reduced typing of one object name during
development (you can't see what object you're applying
the With operator to from within in the middle of a long With
block).
If you want to simulate With in Java, then you can use abbreviated
variable names,
but this also obscures your code (but it can be applied to more
than one object at the same time, while With can't).
Another alternative is to refactor so that the With block is a new
method with the object passed in as a parameter. You can use a
reduced parameter name length (without making it obscure).
If you need to convert from VB to Java and you are depending on the results being reliable and accurate, then you will want to have VB to Java Converter, the best VB to Java converter, at your fingertips.