org.pcollections.PSequence Maven / Gradle / Ivy
/*
* Copyright (c) 2008 Harold Cooper. All rights reserved.
* Licensed under the MIT License.
* See LICENSE file in the project root for full license information.
*/
package org.pcollections;
import java.util.Collection;
import java.util.List;
/**
* An immutable, persistent indexed collection.
*
* @author harold
* @param
*/
public interface PSequence extends PCollection, List {
// @Override
public PSequence plus(E e);
// @Override
public PSequence plusAll(Collection extends E> list);
/**
* @param i
* @param e
* @return a sequence consisting of the elements of this with e replacing the element at index i.
* @throws IndexOutOfBOundsException if i<0 || i>=this.size()
*/
public PSequence with(int i, E e);
/**
* @param i
* @param e non-null
* @return a sequence consisting of the elements of this with e inserted at index i.
* @throws IndexOutOfBOundsException if i<0 || i>this.size()
*/
public PSequence plus(int i, E e);
/**
* @param i
* @param list
* @return a sequence consisting of the elements of this with list inserted at index i.
* @throws IndexOutOfBOundsException if i<0 || i>this.size()
*/
public PSequence plusAll(int i, Collection extends E> list);
/** Returns a sequence consisting of the elements of this without the first occurrence of e. */
// @Override
public PSequence minus(Object e);
// @Override
public PSequence minusAll(Collection> list);
/**
* @param i
* @return a sequence consisting of the elements of this with the element at index i removed.
* @throws IndexOutOfBOundsException if i<0 || i>=this.size()
*/
public PSequence minus(int i);
// @Override
public PSequence subList(int start, int end);
@Deprecated
boolean addAll(int index, Collection extends E> c);
@Deprecated
E set(int index, E element);
@Deprecated
void add(int index, E element);
@Deprecated
E remove(int index);
}