class KeyValueListOutput<K, V> extends CommandOutput<K, V, List<KeyValue<K, V>>>
        implements StreamingOutput<KeyValue<K, V>> {

    private boolean initialized;

    private Subscriber<KeyValue<K, V>> subscriber;

    private final Iterable<K> keys;

    private Iterator<K> keyIterator;

    private K key;

    private boolean hasKey;

    public KeyValueListOutput(RedisCodec<K, V> codec) {
        super(codec, Collections.emptyList());
        setSubscriber(ListSubscriber.instance());
        this.keys = null;
    }

    public KeyValueListOutput(RedisCodec<K, V> codec, Iterable<K> keys) {
        super(codec, Collections.emptyList());
        setSubscriber(ListSubscriber.instance());
        this.keys = keys;
    }

    @Override
    public void set(ByteBuffer bytes) {<FILL_FUNCTION_BODY>}

    @Override
    public void multi(int count) {

        if (!initialized) {
            output = OutputFactory.newList(keys == null ? count / 2 : count);
            initialized = true;
        }
    }

    @Override
    public void setSubscriber(Subscriber<KeyValue<K, V>> subscriber) {
        LettuceAssert.notNull(subscriber, "Subscriber must not be null");
        this.subscriber = subscriber;
    }

    @Override
    public Subscriber<KeyValue<K, V>> getSubscriber() {
        return subscriber;
    }

}


        if (keys == null) {
            if (!hasKey) {
                key = codec.decodeKey(bytes);
                hasKey = true;
                return;
            }

            K key = this.key;
            this.key = null;
            this.hasKey = false;
            subscriber.onNext(output, KeyValue.fromNullable(key, bytes == null ? null : codec.decodeValue(bytes)));

        } else {
            if (keyIterator == null) {
                keyIterator = keys.iterator();
            }

            subscriber.onNext(output,
                    KeyValue.fromNullable(keyIterator.next(), bytes == null ? null : codec.decodeValue(bytes)));
        }
    
<methods>public void <init>(RedisCodec<K,V>, List<KeyValue<K,V>>) ,public void complete(int) ,public List<KeyValue<K,V>> get() ,public java.lang.String getError() ,public boolean hasError() ,public void multi(int) ,public void multiArray(int) ,public void multiMap(int) ,public void multiPush(int) ,public void multiSet(int) ,public void set(java.nio.ByteBuffer) ,public void set(long) ,public void set(double) ,public void set(boolean) ,public void setBigNumber(java.nio.ByteBuffer) ,public void setError(java.nio.ByteBuffer) ,public void setError(java.lang.String) ,public void setSingle(java.nio.ByteBuffer) ,public java.lang.String toString() <variables>protected final non-sealed RedisCodec<K,V> codec,protected java.lang.String error,protected List<KeyValue<K,V>> output