All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.lettuce.core.output.MapComplexData Maven / Gradle / Ivy

Go to download

Advanced and thread-safe Java Redis client for synchronous, asynchronous, and reactive usage. Supports Cluster, Sentinel, Pipelining, Auto-Reconnect, Codecs and much more.

The newest version!
/*
 * Copyright 2024, Redis Ltd. and Contributors
 * All rights reserved.
 *
 * Licensed under the MIT License.
 */

package io.lettuce.core.output;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * An implementation of the {@link ComplexData} that handles maps.
 * 

* All data structures that the implementation returns are unmodifiable * * @see ComplexData * @author Tihomir Mateev * @since 6.5 */ class MapComplexData extends ComplexData { private final Map data; private Object key; public MapComplexData(int count) { data = new HashMap<>(count); } @Override public void storeObject(Object value) { if (key == null) { key = value; } else { data.put(key, value); key = null; } } @Override public Map getDynamicMap() { return Collections.unmodifiableMap(data); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy