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

com.carrotsearch.hppcrt.IntIndexedContainer Maven / Gradle / Ivy

Go to download

High Performance Primitive Collections Realtime (fork of HPPC from Carrotsearch) Fundamental data structures (maps, sets, lists, queues, heaps, sorts) generated for combinations of object and primitive types to conserve JVM memory and speed up execution. The Realtime fork intends to extend the existing collections, by tweaking to remove any dynamic allocations at runtime, and to obtain low variance execution times whatever the input nature.

The newest version!
package com.carrotsearch.hppcrt;

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

import com.carrotsearch.hppcrt.predicates.IntPredicate;
import com.carrotsearch.hppcrt.procedures.IntProcedure;

/**
 * An indexed container provides random access to elements based on an
 * index. Indexes are zero-based.
 */
 @javax.annotation.Generated(
    date = "2017-07-11T19:16:23+0200",
    value = "KTypeIndexedContainer.java") 
public interface IntIndexedContainer extends IntCollection, RandomAccess
{
    /**
     * Removes the first element that equals e1, returning its
     * deleted position or -1 if the element was not found.
     */
    int removeFirst(int e1);

    /**
     * Removes the last element that equals e1, returning its
     * deleted position or -1 if the element was not found.
     */
    int removeLast(int e1);

    /**
     * Returns the index of the first occurrence of the specified element in this list,
     * or -1 if this list does not contain the element.
     */
    int indexOf(int e1);

    /**
     * Returns the index of the last occurrence of the specified element in this list,
     * or -1 if this list does not contain the element.
     */
    int lastIndexOf(int e1);

    /**
     * Adds an element to the end of this container (the last index is incremented by one).
     */
    void add(int e1);

    /**
     * Inserts the specified element at the specified position in this list.
     * 
     * @param index The index at which the element should be inserted, shifting
     * any existing and subsequent elements to the right.
     * Precondition : index must be valid !
     */
    void insert(int index, int e1);

    /**
     * Replaces the element at the specified position in this list
     * with the specified element.
     * Precondition : index must be valid !
     * @return Returns the previous value in the list.
     */
    int set(int index, int e1);

    /**
     * @return Returns the element at index index from the list.
     * Precondition : index must be valid !
     */
    public int get(int index);

    /**
     * Removes the element at the specified position in this list and returns it.
     * Precondition : index must be valid !
     * 

Careful. Do not confuse this method with the overridden signature in * Java Collections ({@link List#remove(Object)}). Use: {@link #removeAll}, * {@link #removeFirst} or {@link #removeLast} depending * on the actual need.

*/ int remove(int index); /** * Removes from this list all of the elements whose index is between * fromIndex, inclusive, and toIndex, exclusive. */ void removeRange(int fromIndex, int toIndex); /** * Applies procedure to a slice of the container, * fromIndex, inclusive, to toIndex, exclusive. */ T forEach(final T procedure, final int fromIndex, final int toIndex); /** * Applies predicate to a slice of the container, * fromIndex, inclusive, to toIndex, * exclusive, or until predicate returns false. */ T forEach(final T predicate, final int fromIndex, final int toIndex); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy