Isolated unchecked cast warning from FastQueue.poll()

This commit is contained in:
Trustin Lee 2008-09-28 13:57:17 +00:00
parent 6611563c8c
commit 597cbd870c

View File

@ -55,7 +55,6 @@ public class FastQueue<E> {
elements[size ++] = e; elements[size ++] = e;
} }
@SuppressWarnings("unchecked")
public E poll() { public E poll() {
for (;;) { for (;;) {
if (drainedElements == null) { if (drainedElements == null) {
@ -72,11 +71,16 @@ public class FastQueue<E> {
} }
if (index < drainedElementCount) { if (index < drainedElementCount) {
return (E) drainedElements[index ++]; return cast(drainedElements[index ++]);
} }
drainedElements = null; drainedElements = null;
} }
return null; return null;
} }
@SuppressWarnings("unchecked")
private E cast(Object o) {
return (E) o;
}
} }