如何将以下1.5+构造重写为1.4?
final class FooList<T> extends AbstractList<T> implements ...
{
private T[] tab;
...
}
public ListIterator<T> listIterator() {...}
public int bar(int x, Collection<? extends T> c) {...}
for (Foo f : s.baz(x)) {...}
for (Map.Entry<Object, Object> e : p.entrySet()) {...}
答案 0 :(得分:1)
您的代码中的Java 1.4中不支持任何内容
答案 1 :(得分:1)
final class FooList extends AbstractList implements ...
{
private Object[] tab;
...
}
public ListIterator listIterator() {...}
public int bar(int x, Collection c) {...}
for (Iterator it = s.baz(x).iterator(); it.hasNext();) {
final Foo f = (Foo) it.next();
...
}
for (Iterator it = p.entrySet().iterator(); it.hasNext();) {
final Map.Entry e = (Map.Entry) it.next();
...
}
当然还有所有必要的垂头丧气。
答案 2 :(得分:0)
您可以尝试Retroweaver,它允许在Java 1.4中使用Java 5的某些功能。