Quantcast
Viewing latest article 5
Browse Latest Browse All 15

Java: can you synchronize a variable without explicitly creating blocks?

Is it possible to synchronize a variable such that all references to that variable are implicitly assumed to be synchronized? I’m thinking something like the following: synchronized List l = new LinkedList(); // I know this isn't valid l.add(4) l.set(0, new Integer(5)); // add a bunch of things l.get((int) (Math.random()*l.size())); would be compiled as List […]

The post Java: can you synchronize a variable without explicitly creating blocks? appeared first on BlogoSfera.


Viewing latest article 5
Browse Latest Browse All 15

Trending Articles