Skip to content

Commit

Permalink
Switch default Queue implementation to ArrayDeque.
Browse files Browse the repository at this point in the history
Now that we require Java 1.6 or newer this much more efficient implementation can be used as the default.
  • Loading branch information
JakeWharton committed Apr 27, 2016
1 parent 8537c89 commit 371aff7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
Expand Down Expand Up @@ -163,7 +163,7 @@ private <T> ObjectConstructor<T> newDefaultImplementationConstructor(
} else if (Queue.class.isAssignableFrom(rawType)) {
return new ObjectConstructor<T>() {
@Override public T construct() {
return (T) new LinkedList<Object>();
return (T) new ArrayDeque<Object>();
}
};
} else {
Expand Down

0 comments on commit 371aff7

Please sign in to comment.