I am not sure if I asked right in title but here is the problem. I have a class that does a jop asyncronously and also has to run on Swing UI thread. like this
SwingUtilities.invokeLater(() -> {
myobj.dosomething(()->{
SwingUtilities.invokeLater(() -> {
myobj.dosomething(()->{
//here it needs to repeat this again and again.
//for an indefinte number of times. So it is hedious to reapat this code
//for few times and impossible to make it dynamic based on user input.
//it was even worse without lambda sytax.
});
});
});
});
Edit:I probably shouldn't have mentioned swing at all. Because it is not the problem it only adds to it. The main problem is that I need to call myobj.dosomething(()->{
too many times. And every time it should start after the previous call is done.