generics
diff --git a/core/plugins/org.eclipse.dltk.formatter/src/org/eclipse/dltk/formatter/FormatterWriter.java b/core/plugins/org.eclipse.dltk.formatter/src/org/eclipse/dltk/formatter/FormatterWriter.java
index f4dea0c..6d47206 100644
--- a/core/plugins/org.eclipse.dltk.formatter/src/org/eclipse/dltk/formatter/FormatterWriter.java
+++ b/core/plugins/org.eclipse.dltk.formatter/src/org/eclipse/dltk/formatter/FormatterWriter.java
@@ -13,7 +13,6 @@
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.dltk.formatter.internal.ExcludeRegionList;
@@ -31,7 +30,7 @@
private boolean lineStarted = false;
private char lastChar = 0;
private int lineNumber = 0;
- private final List newLineCallbacks = new ArrayList();
+ private final List<IFormatterCallback> newLineCallbacks = new ArrayList<IFormatterCallback>();
private final String lineDelimiter;
private final IFormatterDocument document;
@@ -278,10 +277,10 @@
}
};
- final List copy = new ArrayList(newLineCallbacks);
+ IFormatterCallback[] copy = newLineCallbacks
+ .toArray(new IFormatterCallback[newLineCallbacks.size()]);
newLineCallbacks.clear();
- for (Iterator i = copy.iterator(); i.hasNext();) {
- IFormatterCallback callback = (IFormatterCallback) i.next();
+ for (IFormatterCallback callback : copy) {
callback.call(context, callbackWriter);
}
}