IReadOnlyList

All Implemented Interfaces: java.lang.Iterable

public interface IReadOnlyList<T> extends Iterable<T>

Represents a read-only collection of elements that can be accessed by index.

T : The type of elements in the read-only list.

Methods

Method Description
getCount() Gets the number of elements contained in the collection.
get_Item(int index) Gets the element at the specified index in the read-only list.
indexOf(T item) Determines the index of a specific item in the collection.
contains(T item) Determines whether the collection contains a specific item.

getCount()

public abstract int getCount()

Gets the number of elements contained in the collection.

Returns: int - The number of elements contained in the collection.

get_Item(int index)

public abstract T get_Item(int index)

Gets the element at the specified index in the read-only list.

Parameters:

Parameter Type Description
index int The zero-based index of the element to get.

Returns: T - The element at the specified index in the read-only list.

indexOf(T item)

public abstract int indexOf(T item)

Determines the index of a specific item in the collection.

Parameters:

Parameter Type Description
item T The item to locate in the collection.

Returns: int - The index of item if found in the collection; otherwise, -1.

contains(T item)

public abstract boolean contains(T item)

Determines whether the collection contains a specific item.

Parameters:

Parameter Type Description
item T The item to locate in the collection.

Returns: boolean - True if the item is found in the collection; otherwise, false.