AnyLogic
Expand
Font size
Type Parameters:
E - element type
All Superinterfaces:
Iterable<T>
All Known Implementing Classes:
AgentArrayList, AgentLinkedHashSet, AgentList

@AnyLogicInternalAPI
public interface IterableWithSize<T>
extends Iterable<T>
This interface is internal and shouldn't be called by user.
it may be removed/renamed in future.

Declares a collection with known size and ability to get element by index.
Author:
AnyLogic North America, LLC https://anylogic.com

Method Summary

Modifier and TypeMethodDescription
Tget(int index)
Returns the element at the specified position in this collection.
Depending on implementation, this method may have good or bad performance.
booleanisEmpty()
Returns true if this collection contains no elements.
intsize()
Returns the number of elements in this collection.

Methods inherited from interface java.lang.Iterable

forEach, iterator, spliterator

Method Details

size

int size()
Returns the number of elements in this collection.
Returns:
the number of elements in this collection

isEmpty

boolean isEmpty()
Returns true if this collection contains no elements.
Returns:
true if this collection contains no elements

get

T get(int index)
Returns the element at the specified position in this collection.
Depending on implementation, this method may have good or bad performance.
Parameters:
index - index of the element to return
Returns:
the element at the specified position in this list
Throws:
IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())