Top Fields Constructors Methods
org.antlr.v4.runtime.misc

public Class IntegerList

extends Object
Class Inheritance
Known Direct Subclasses
org.antlr.v4.runtime.misc.IntegerStack
Imports
java.util.Arrays, .Collection, .List

Author
Sam Harwell

Field Summary

Modifier and TypeField and Description
private int[]
private int
private static int[]
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public
public
IntegerList(int capacity)

public
public

Method Summary

Modifier and TypeMethod and Description
public final void
add(int value)

public final void
addAll(int[] array)

public final void
public final void
public final int
binarySearch(int key)

public final int
binarySearch(int fromIndex, int toIndex, int key)

public final void
public final boolean
contains(int value)

private void
ensureCapacity(int capacity)

public boolean

Returns:

true if the specified object is equal to this list
equals
(Object
the object to be compared for equality with this list
o
)

Overrides java.lang.Object.equals.

Compares the specified object with this list for equality.
public final int
get(int index)

public int

Returns:

the hash code value for this list
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this list.
public final boolean
public final int
removeAt(int index)

public final void
removeRange(int fromIndex, int toIndex)

public final int
set(int index, int value)

public final int
size()

public final void
sort()

public final int[]
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of this list.
public final void
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

_databack to summary
private int[] _data
Annotations
@NotNull
_sizeback to summary
private int _size
EMPTY_DATAback to summary
private static int[] EMPTY_DATA
INITIAL_SIZEback to summary
private static final int INITIAL_SIZE
MAX_ARRAY_SIZEback to summary
private static final int MAX_ARRAY_SIZE

Constructor Detail

IntegerListback to summary
public IntegerList()
IntegerListback to summary
public IntegerList(int capacity)
IntegerListback to summary
public IntegerList(IntegerList list)
IntegerListback to summary
public IntegerList(Collection<Integer> list)

Method Detail

addback to summary
public final void add(int value)
addAllback to summary
public final void addAll(int[] array)
addAllback to summary
public final void addAll(IntegerList list)
addAllback to summary
public final void addAll(Collection<Integer> list)
binarySearchback to summary
public final int binarySearch(int key)
binarySearchback to summary
public final int binarySearch(int fromIndex, int toIndex, int key)
clearback to summary
public final void clear()
containsback to summary
public final boolean contains(int value)
ensureCapacityback to summary
private void ensureCapacity(int capacity)
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Compares the specified object with this list for equality. Returns true if and only if the specified object is also an IntegerList, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. In other words, two lists are defined to be equal if they contain the same elements in the same order.

This implementation first checks if the specified object is this list. If so, it returns true; if not, it checks if the specified object is an IntegerList. If not, it returns false; if so, it checks the size of both lists. If the lists are not the same size, it returns false; otherwise it iterates over both lists, comparing corresponding pairs of elements. If any comparison returns false, this method returns false.

Parameters
o:Object

the object to be compared for equality with this list

Returns:boolean

true if the specified object is equal to this list

Annotations
@Override
getback to summary
public final int get(int index)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this list.

This implementation uses exactly the code that is used to define the list hash function in the documentation for the List#hashCode method.

Returns:int

the hash code value for this list

Annotations
@Override
isEmptyback to summary
public final boolean isEmpty()
removeAtback to summary
public final int removeAt(int index)
removeRangeback to summary
public final void removeRange(int fromIndex, int toIndex)
setback to summary
public final int set(int index, int value)
sizeback to summary
public final int size()
sortback to summary
public final void sort()
toArrayback to summary
public final int[] toArray()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a string representation of this list.

Returns:String

Doc from java.lang.Object.toString.

a string representation of the object.

Annotations
@Override
trimToSizeback to summary
public final void trimToSize()