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

org.redisson.api.RList Maven / Gradle / Ivy

There is a newer version: 0.40.13
Show newest version
/**
 * Copyright 2018 Nikita Koksharov
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.redisson.api;

import java.util.List;
import java.util.RandomAccess;

import org.redisson.api.mapreduce.RCollectionMapReduce;

/**
 * Distributed and concurrent implementation of {@link java.util.List}
 *
 * @author Nikita Koksharov
 *
 * @param  the type of elements held in this collection
 */
public interface RList extends List, RExpirable, RListAsync, RSortable>, RandomAccess {

    /**
     * Loads elements by specified indexes
     * 
     * @param indexes of elements
     * @return list of elements
     */
    List get(int ...indexes);
    
    /**
     * Returns RMapReduce object associated with this map
     * 
     * @param  output key
     * @param  output value
     * @return MapReduce instance
     */
     RCollectionMapReduce mapReduce();
    
    /**
     * Add element after elementToFind
     * 
     * @param elementToFind - object to find
     * @param element - object to add
     * @return new list size
     */
    int addAfter(V elementToFind, V element);
    
    /**
     * Add element before elementToFind
     * 
     * @param elementToFind - object to find
     * @param element - object to add
     * @return new list size
     */
    int addBefore(V elementToFind, V element);
    
    /**
     * Set element at index.
     * Works faster than {@link #set(int, Object)} but 
     * doesn't return previous element.
     * 
     * @param index - index of object
     * @param element - object to set
     */
    void fastSet(int index, V element);

    RList subList(int fromIndex, int toIndex);

    /**
     * Read all elements at once
     *
     * @return list of values
     */
    List readAll();

    /**
     * Trim list and remains elements only in specified range
     * fromIndex, inclusive, and toIndex, inclusive.
     *
     * @param fromIndex - from index
     * @param toIndex - to index
     */
    void trim(int fromIndex, int toIndex);

    /**
     * Remove object by specified index
     * 
     * @param index - index of object
     */
    void fastRemove(int index);
    
    boolean remove(Object o, int count);
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy