Java 类com.badlogic.gdx.utils.Queue 实例源码

项目:gdx-cclibs    文件:QueueSerializer.java   
@Override
public Queue read(Kryo kryo, Input input, Class<Queue> type) {
    int length = input.readVarInt(true);
    Registration registration = kryo.readClass(input);
    Class cls = registration == null ? Object.class : registration.getType();
    Queue queue = new Queue(length, cls);
    kryo.reference(queue);
    Class elementClass = null;
    Serializer serializer = null;
    if (genericType != null) {
        elementClass = genericType;
        serializer = kryo.getSerializer(genericType);
        genericType = null;
    }
    if (serializer != null) {
        for (int i = 0; i < length; i++)
            queue.addLast(kryo.readObjectOrNull(input, elementClass, serializer));
    } else {
        for (int i = 0; i < length; i++)
            queue.addLast(kryo.readClassAndObject(input));
    }
    return queue;
}
项目:Mundus    文件:BreadthFirstIterator.java   
public BreadthFirstIterator(GameObject root) {
    queue = new Queue<GameObject>();
    queue.addLast(root);
}