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

com.epam.deltix.util.collections.generated.ObjectList Maven / Gradle / Ivy

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 ObjectTypes. Much more efficient than
 *	keeping a java.util.ArrayList of ObjectType.
 */
public interface ObjectList 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")
    ObjectType getObject (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")
    ObjectType getObjectNoRangeCheck (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 ObjectType. */ @SuppressWarnings("unchecked") T [] toArray(T a[]); /** * 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()). */ ObjectType get (int index); /** * 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 (Object elem); /** * Returns the index of the last occurrence of the specified ObjectType in * this list. * * @param elem the desired element. * @return the index of the last occurrence of the specified ObjectType in * this list; returns -1 if the object is not found. */ int lastIndexOf (Object elem); /** * Returns a ObjectType 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. */ Object [] toObjectArray (); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy