sketch a few more classpath classes

This commit is contained in:
Joel Dice
2007-07-21 14:44:39 -06:00
parent 48226f988c
commit fd770fd884
17 changed files with 497 additions and 7 deletions

View File

@ -0,0 +1,36 @@
package java.lang;
import java.util.Map;
public class ThreadLocal<T> {
private static final Object Null = new Object();
protected T initialValue() {
return null;
}
public T get() {
Map<ThreadLocal, Object> map = Thread.currentThread().locals();
Object o = map.get(this);
if (o == null) {
o = initialValue();
if (o == null) {
o = Null;
}
map.put(this, o);
}
if (o == Null) {
o = null;
}
return (T) o;
}
public void set(T value) {
Map<ThreadLocal, Object> map = Thread.currentThread().locals();
Object o = value;
if (o == null) {
o = Null;
}
map.put(this, o);
}
}