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

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

There is a newer version: 3.36.0
Show newest version
/**
 * Copyright (c) 2013-2021 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.Collection;

import org.reactivestreams.Publisher;

import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.core.Single;

/**
 * Common RxJava2 interface for collection object
 * 
 * @author Nikita Koksharov
 *
 * @param  value
 */
public interface RCollectionRx extends RExpirableRx {

    /**
     * Returns iterator over collection elements
     * 
     * @return iterator
     */
    Flowable iterator();

    /**
     * Retains only the elements in this collection that are contained in the
     * specified collection (optional operation).
     *
     * @param c collection containing elements to be retained in this collection
     * @return true if this collection changed as a result of the call
     */
    Single retainAll(Collection c);

    /**
     * Removes all of this collection's elements that are also contained in the
     * specified collection (optional operation).
     *
     * @param c collection containing elements to be removed from this collection
     * @return true if this collection changed as a result of the
     *         call
     */
    Single removeAll(Collection c);

    /**
     * Returns true if this collection contains encoded state of the specified element.
     *
     * @param o element whose presence in this collection is to be tested
     * @return true if this collection contains the specified
     *         element and false otherwise
     */
    Single contains(V o);

    /**
     * Returns true if this collection contains all of the elements
     * in the specified collection.
     *
     * @param  c collection to be checked for containment in this collection
     * @return true if this collection contains all of the elements
     *         in the specified collection
     */
    Single containsAll(Collection c);

    /**
     * Removes a single instance of the specified element from this
     * collection, if it is present (optional operation).
     *
     * @param o element to be removed from this collection, if present
     * @return true if an element was removed as a result of this call
     */
    Single remove(V o);

    /**
     * Returns number of elements in this collection.
     *
     * @return size of collection
     */
    Single size();

    /**
     * Adds element into this collection.
     * 
     * @param e - element to add
     * @return true if an element was added 
     *          and false if it is already present
     */
    Single add(V e);

    /**
     * Adds all elements contained in the specified collection
     * 
     * @param c - collection of elements to add
     * @return true if at least one element was added 
     *          and false if all elements are already present
     */
    Single addAll(Publisher c);
    
    /**
     * Adds all elements contained in the specified collection
     * 
     * @param c - collection of elements to add
     * @return true if at least one element was added 
     *          and false if all elements are already present
     */
    Single addAll(Collection c);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy