I have a method in a class that is called roughly at the same time two different objects.
public void doSomething(final int i)
{
    if(getId() == i)
    {
        System.out.println("outer "+i);
        Platform.runLater(new Runnable()
        {
            @Override
            public void run()
            {
                System.out.println("inner "+i);
            }
        }
    }
}
It is checked if the object is supposed to do something according to its id. If the id is correct, I use Platform.runLater because I do something with JavaFX.
The problem is: When the objects with the IDs 1 and 2 should do something, the output is like this:
outer 1
outer 2
inner 2
inner 2
Why doesn't the inner method uses the correct value but somehow uses the same value twice?
Edit: Corrected the inner method
