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

it.unimi.dsi.fastutil.BigList Maven / Gradle / Ivy

Go to download

fastutil extends the Java Collections Framework by providing type-specific maps, sets, lists, and queues with a small memory footprint and fast access and insertion; it provides also big (64-bit) arrays, sets and lists, sorting algorithms, fast, practical I/O classes for binary and text files, and facilities for memory mapping large files. Note that if you have both this jar and fastutil-core.jar in your dependencies, fastutil-core.jar should be excluded.

There is a newer version: 8.5.13
Show newest version
/*
 * Copyright (C) 2010-2023 Sebastiano Vigna
 *
 * 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 it.unimi.dsi.fastutil;

import java.util.Collection;
import java.util.List;

/** A list with big (i.e., 64-bit) indices.
 *
 * 

Instances of this class implement the same semantics as that of {@link List}: however, * getters and setters use long indices, search methods return long values, * and iterators are of type {@link BigListIterator}. */ public interface BigList extends Collection, Size64 { /** Returns the element at the specified position. * * @param index a position in the big list. * @return the element at the specified position. * @see List#get(int) */ K get(long index); /** Removes the element at the specified position. * * @param index a position in the big list. * @return the element previously at the specified position. * @see List#remove(int) */ K remove(long index); /** Replaces the element at the specified position in this big list with the specified element (optional operation). * * @param index a position in the big list. * @param element the element to be stored at the specified position. * @return the element previously at the specified positions. * @see List#set(int,Object) */ K set(long index, K element); /** Inserts the specified element at the specified position in this big list (optional operation). * * @param index a position in the big list. * @param element an element to be inserted. * @see List#add(int,Object) */ void add(long index, K element); /** Sets the size of this big list. * *

If the specified size is smaller than the current size, the last elements are * discarded. Otherwise, they are filled with 0/{@code null}/{@code false}. * * @param size the new size. */ void size(long size); /** Inserts all of the elements in the specified collection into this big list at the specified position (optional operation). * * @param index index at which to insert the first element from the specified collection. * @param c collection containing elements to be added to this big list. * @return {@code true} if this big list changed as a result of the call * @see List#addAll(int, Collection) */ boolean addAll(long index, Collection c); /** Returns the index of the first occurrence of the specified element in this big list, or -1 if this big list does not contain the element. * * @param o the object to search for. * @return the index of the first occurrence of the specified element in this big list, or -1 if this big list does not contain the element. * @see List#indexOf(Object) */ long indexOf(Object o); /** Returns the index of the last occurrence of the specified element in this big list, or -1 if this big list does not contain the element. * * @param o the object to search for. * @return the index of the last occurrence of the specified element in this big list, or -1 if this big list does not contain the element. * @see List#lastIndexOf(Object) */ long lastIndexOf(Object o); /** Returns a big-list iterator over the elements in this big list. * * @return a big-list iterator over the elements in this big list. * @see List#listIterator() */ BigListIterator listIterator(); /** Returns a big-list iterator of the elements in this big list, starting at the specified position in this big list. * * @param index index of first element to be returned from the big-list iterator. * @return a big-list iterator of the elements in this big list, starting at the specified position in * this big list. * @see List#listIterator(int) */ BigListIterator listIterator(long index); /** Returns a big sublist view of this big list. * * @param from the starting element (inclusive). * @param to the ending element (exclusive). * @return a big sublist view of this big list. * @see List#subList(int, int) */ BigList subList(long from, long to); /** {@inheritDoc} * @deprecated Use {@link #size64()} instead. */ @Override @Deprecated default int size() { return Size64.super.size(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy