This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a class with an object which contains a list of Strings. In this class I have a runnable method where I want to access this object to add an element in his list.
However, it seems that in my runnable method, the object is not modified. No error is happening.
Also...maybe there are bits missing that would change this interpretation, but it looks like you're asking the Runnable to be executed in another thread, but then immediately checking the size of the list. Even if the Runnable is being executed correctly, there's no reason to believe that it would have been executed by the time you check it.
(I'm assuming that line 15 should be o.getList().size() or similar)