A DESCRIPTION OF THE PROBLEM :
'RWDictionary' example contains compile time error. The next piece of code cannot be compiled:
public String[] allKeys() {
r.lock();
try { return m.keySet().toArray(); }
finally { r.unlock(); }
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
it should be:
return m.keySet().toArray(new String[0]);
ACTUAL -
error: incompatible types
try { return m.keySet().toArray(); }
^
required: String[]
found: Object[]
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html
'RWDictionary' example contains compile time error. The next piece of code cannot be compiled:
public String[] allKeys() {
r.lock();
try { return m.keySet().toArray(); }
finally { r.unlock(); }
}
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
it should be:
return m.keySet().toArray(new String[0]);
ACTUAL -
error: incompatible types
try { return m.keySet().toArray(); }
^
required: String[]
found: Object[]
URL OF FAULTY DOCUMENTATION :
http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/ReentrantReadWriteLock.html