Top Description Fields Constructors Methods
org.eclipse.jgit.util

public Class LongList

extends Object
Class Inheritance
Imports
java.util.Arrays

A more efficient List<Long> using a primitive long array.

Field Summary

Modifier and TypeField and Description
private int
private long[]

Constructor Summary

AccessConstructor and Description
public
LongList()

Create an empty list with a default capacity.

public
LongList(int
number of entries the list can initially hold.
capacity
)

Create an empty list with the specified capacity.

Method Summary

Modifier and TypeMethod and Description
public void
add(long
the number to add.
n
)

Add an entry to the end of the list.

public void
clear()

Clear this list

public boolean

Returns:

true of value appears in this list.
contains
(long
the value to search for.
value
)

Determine if an entry appears in this collection.

public void
fillTo(int
index position to stop filling at. 0 inserts no filler. 1 ensures the list has a size of 1, adding val if the list is currently empty.
toIndex
,
long
value to insert into padded positions.
val
)

Pad the list with entries.

public long

Returns:

the number at the specified index
get
(int
index to read, must be in the range [0, size()).
i
)

Get the value at the specified index

private void
grow()

public void
set(int
index to set, must be in the range [0, size()).
index
,
long
value to store at the position.
n
)

Assign an entry in the list.

public int

Returns:

number of entries in this list
size
()

Get number of entries in this list

public void
sort()

Sort the list of longs according to their natural ordering.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

countback to summary
private int count
entriesback to summary
private long[] entries

Constructor Detail

LongListback to summary
public LongList()

Create an empty list with a default capacity.

LongListback to summary
public LongList(int capacity)

Create an empty list with the specified capacity.

Parameters
capacity:int

number of entries the list can initially hold.

Method Detail

addback to summary
public void add(long n)

Add an entry to the end of the list.

Parameters
n:long

the number to add.

clearback to summary
public void clear()

Clear this list

containsback to summary
public boolean contains(long value)

Determine if an entry appears in this collection.

Parameters
value:long

the value to search for.

Returns:boolean

true of value appears in this list.

fillToback to summary
public void fillTo(int toIndex, long val)

Pad the list with entries.

Parameters
toIndex:int

index position to stop filling at. 0 inserts no filler. 1 ensures the list has a size of 1, adding val if the list is currently empty.

val:long

value to insert into padded positions.

getback to summary
public long get(int i)

Get the value at the specified index

Parameters
i:int

index to read, must be in the range [0, size()).

Returns:long

the number at the specified index

Exceptions
ArrayIndexOutOfBoundsException:
the index outside the valid range
growback to summary
private void grow()
setback to summary
public void set(int index, long n)

Assign an entry in the list.

Parameters
index:int

index to set, must be in the range [0, size()).

n:long

value to store at the position.

sizeback to summary
public int size()

Get number of entries in this list

Returns:int

number of entries in this list

sortback to summary
public void sort()

Sort the list of longs according to their natural ordering.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override