
io.lettuce.core.output.ArrayComplexData Maven / Gradle / Ivy
Show all versions of lettuce-core Show documentation
/*
* Copyright 2024, Redis Ltd. and Contributors
* All rights reserved.
*
* Licensed under the MIT License.
*/
package io.lettuce.core.output;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* An implementation of the {@link ComplexData} that handles arrays.
*
* For RESP2 calling the {@link ComplexData#getDynamicMap()} would heuristically go over the list of elements assuming every odd
* element is a key and every even object is the value and then adding them to an {@link Map}. The logic would follow the same
* order that was used when the elements were added to the {@link ArrayComplexData}. Similarly calling the
* {@link ComplexData#getDynamicSet()} would return a set of all the elements, adding them in the same order. If - for some
* reason - duplicate elements exist they would be overwritten.
*
* All data structures that the implementation returns are unmodifiable
*
* @see ComplexData
* @author Tihomir Mateev
* @since 6.5
*/
class ArrayComplexData extends ComplexData {
private final List