I would like to use try-with-resources. I have two resources, where second depend on first. After initialize first, I need to execute method on first resources. Next I can initialize second resource. What can I do it?
try (First first = resource.get());
--Here I need run method: first.connect(...);
Second second = first.get())
{
...
}