com.epam.deltix.util.collections.generated.IntegerList Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of timebase-collections Show documentation
Show all versions of timebase-collections Show documentation
Timebase Common utilities and collections
The newest version!
/*
* Copyright 2021 EPAM Systems, Inc
*
* See the NOTICE file distributed with this work for additional information
* regarding copyright ownership. 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 com.epam.deltix.util.collections.generated;
/**
* Resizable array of primitive ints. Much more efficient than
* keeping a java.util.ArrayList
of Integer
.
*/
public interface IntegerList extends Cloneable {
/**
* Returns the number of elements in this list.
*
* @return the number of elements in this list.
*/
int size ();
/**
* Tests if this list has no elements.
*
* @return true if this list has no elements;
* false otherwise.
*/
boolean isEmpty();
/**
* Returns the element at the specified position in this list.
*
* @param index index of element to return.
* @return the element at the specified position in this list.
* @throws IndexOutOfBoundsException if index is out of range (index
* < 0 || index >= size()).
*/
@SuppressWarnings("unchecked")
int getInteger (int index);
/**
* Returns the element at the specified position in this list, bypassing
* the range check.
* @param index index of element to return.
* @return the element at the specified position in this list.
*/
@SuppressWarnings("unchecked")
int getIntegerNoRangeCheck (int index);
/**
* Returns the element at the specified position in this list.
*
* @param index index of element to return.
* @return the element at the specified position in this list.
* @throws IndexOutOfBoundsException if index is out of range (index
* < 0 || index >= size()).
*/
Integer get (int index);
/**
* Returns an array containing all of the elements in this list in the
* correct order. The runtime type of the returned array is that of the
* specified array. If the list fits in the specified array, it is
* returned therein. Otherwise, a new array is allocated with the runtime
* type of the specified array and the size of this list.
*
* If the list fits in the specified array with room to spare (i.e., the
* array has more elements than the list), the element in the array
* immediately following the end of the collection is set to
* null.
*
* @param a the array into which the elements of the list are to
* be stored, if it is big enough; otherwise, a new array of the
* same runtime type is allocated for this purpose.
* @return an array containing the elements of the list.
* @throws ArrayStoreException if the runtime type of a is not a supertype
* of Integer
.
*/
@SuppressWarnings("unchecked")
T [] toArray(T a[]);
/**
* Returns true if this list contains the specified element.
*
* @param elem element whose presence in this List is to be tested.
*/
boolean contains (int elem);
/**
* Searches for the first occurrence of the given argument, testing
* for equality.
*
* @param elem an object.
* @return the index of the first occurrence of the argument in this
* list; returns -1 if the object is not found.
*/
int indexOf (int elem);
/**
* Returns the index of the last occurrence of the specified int in
* this list.
*
* @param elem the desired element.
* @return the index of the last occurrence of the specified int in
* this list; returns -1 if the object is not found.
*/
int lastIndexOf (int elem);
/**
* Returns a int array containing all of the elements in this list
* in the correct order.
*
* @return an array containing all of the elements in this list
* in the correct order.
*/
int [] toIntArray ();
}