Top Description Fields Constructors Methods
io.github.classgraph

pack-priv Class PotentiallyUnmodifiableList<T>

extends ArrayList<T>
Class Inheritance
Known Direct Subclasses
io.github.classgraph.ResourceList, io.github.classgraph.InfoList
Type Parameters
<T>
the element type
Imports
java.util.ArrayList, .Collection, .Iterator, .ListIterator

A potentially unmodifiable list of objects.

Field Summary

Modifier and TypeField and Description
pack-priv boolean
modifiable

Whether or not the list is modifiable.

pack-priv static final long

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
PotentiallyUnmodifiableList(final int
the size hint
sizeHint
)

Constructor.

pack-priv
PotentiallyUnmodifiableList(final Collection<T>
the initial elements.
collection
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public boolean
add(final T
element to be appended to this list
element
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Appends the specified element to the end of this list.

public void
add(final int
index at which the specified element is to be inserted
index
,
final T
element to be inserted
element
)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Inserts the specified element at the specified position in this list.

public boolean
addAll(final Collection<? extends T>
collection containing elements to be added to this list
c
)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.

public boolean
addAll(final int
index at which to insert the first element from the specified collection
index
,
final Collection<? extends T>
collection containing elements to be added to this list
c
)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll.

Inserts all of the elements in the specified collection into this list, starting at the specified position.

public void
clear()

Overrides java.util.ArrayList.clear.

Implements java.util.List.clear, java.util.Collection.clear.

Removes all of the elements from this list.

public boolean
equals(final Object
the object to be compared for equality with this list
o
)

Overrides java.util.ArrayList.equals.

Implements java.util.List.equals, java.util.Collection.equals.

Compares the specified object with this list for equality.

public int
hashCode()

Overrides java.util.ArrayList.hashCode.

Implements java.util.List.hashCode, java.util.Collection.hashCode.

Returns the hash code value for this list.

public Iterator<T>
iterator()

Overrides java.util.ArrayList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this list in proper sequence.

public ListIterator<T>
listIterator()

Overrides java.util.ArrayList.listIterator.

Implements java.util.List.listIterator.

Returns a list iterator over the elements in this list (in proper sequence).

pack-priv void
makeUnmodifiable()

Make this list unmodifiable.

public boolean
remove(final Object
element to be removed from this list, if present
o
)

Overrides java.util.ArrayList.remove.

Implements java.util.List.remove, java.util.Collection.remove.

Removes the first occurrence of the specified element from this list, if it is present.

public T
remove(final int
the index of the element to be removed
index
)

Overrides java.util.ArrayList.remove.

Implements java.util.List.remove.

Removes the element at the specified position in this list.

public boolean
removeAll(final Collection<?>
collection containing elements to be removed from this list
c
)

Overrides java.util.ArrayList.removeAll.

Implements java.util.List.removeAll, java.util.Collection.removeAll.

Removes from this list all of its elements that are contained in the specified collection.

public boolean
retainAll(final Collection<?>
collection containing elements to be retained in this list
c
)

Overrides java.util.ArrayList.retainAll.

Implements java.util.List.retainAll, java.util.Collection.retainAll.

Retains only the elements in this list that are contained in the specified collection.

public T
set(final int
index of the element to replace
index
,
final T
element to be stored at the specified position
element
)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Replaces the element at the specified position in this list with the specified element.

Inherited from java.util.ArrayList:
addFirstaddLastclonecontainsensureCapacityforEachgetgetFirstgetLastindexOfisEmptylastIndexOflistIteratorremoveFirstremoveIfremoveLastremoveRangereplaceAllsizesortspliteratorsubListtoArraytoArraytrimToSize

Field Detail

modifiableback to summary
pack-priv boolean modifiable

Whether or not the list is modifiable.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides java.util.ArrayList.serialVersionUID.

serialVersionUID.

Constructor Detail

PotentiallyUnmodifiableListback to summary
pack-priv PotentiallyUnmodifiableList()

Constructor.

PotentiallyUnmodifiableListback to summary
pack-priv PotentiallyUnmodifiableList(final int sizeHint)

Constructor.

Parameters
sizeHint:int

the size hint

PotentiallyUnmodifiableListback to summary
pack-priv PotentiallyUnmodifiableList(final Collection<T> collection)

Constructor.

Parameters
collection:Collection<T>

the initial elements.

Method Detail

addback to summary
public boolean add(final T element)

Overrides java.util.ArrayList.add.

Implements java.util.List.add, java.util.Collection.add.

Doc from java.util.ArrayList.add.

Appends the specified element to the end of this list.

Parameters
element:T

element to be appended to this list

Returns:boolean

true (as specified by Collection#add)

Annotations
@Override
addback to summary
public void add(final int index, final T element)

Overrides java.util.ArrayList.add.

Implements java.util.List.add.

Doc from java.util.ArrayList.add.

Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Parameters
index:int

index at which the specified element is to be inserted

element:T

element to be inserted

Annotations
@Override
addAllback to summary
public boolean addAll(final Collection<? extends T> c)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll, java.util.Collection.addAll.

Doc from java.util.ArrayList.addAll.

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.)

Parameters
c:Collection<? extends T>

collection containing elements to be added to this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
addAllback to summary
public boolean addAll(final int index, final Collection<? extends T> c)

Overrides java.util.ArrayList.addAll.

Implements java.util.List.addAll.

Doc from java.util.ArrayList.addAll.

Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.

Parameters
index:int

index at which to insert the first element from the specified collection

c:Collection<? extends T>

collection containing elements to be added to this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
clearback to summary
public void clear()

Overrides java.util.ArrayList.clear.

Implements java.util.List.clear, java.util.Collection.clear.

Doc from java.util.ArrayList.clear.

Removes all of the elements from this list. The list will be empty after this call returns.

Annotations
@Override
equalsback to summary
public boolean equals(final Object o)

Overrides java.util.ArrayList.equals.

Implements java.util.List.equals, java.util.Collection.equals.

Doc from java.util.ArrayList.equals.

Compares the specified object with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if Objects.equals(e1, e2).) In other words, two lists are defined to be equal if they contain the same elements in the same order. This definition ensures that the equals method works properly across different implementations of the List interface.

Parameters
o:Object

Doc from java.util.List.equals.

the object to be compared for equality with this list

Returns:boolean

Doc from java.util.List.equals.

true if the specified object is equal to this list

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.util.ArrayList.hashCode.

Implements java.util.List.hashCode, java.util.Collection.hashCode.

Doc from java.util.ArrayList.hashCode.

Returns the hash code value for this list. The hash code of a list is defined to be the result of the following calculation:

int hashCode = 1;
    for (E e : list)
        hashCode = 31*hashCode + (e==null ? 0 : e.hashCode());
This ensures that list1.equals(list2) implies that list1.hashCode()==list2.hashCode() for any two lists, list1 and list2, as required by the general contract of Object#hashCode.
Returns:int

Doc from java.util.List.hashCode.

the hash code value for this list

Annotations
@Override
iteratorback to summary
public Iterator<T> iterator()

Overrides java.util.ArrayList.iterator.

Implements java.util.List.iterator, java.util.Collection.iterator.

Doc from java.util.ArrayList.iterator.

Returns an iterator over the elements in this list in proper sequence.

The returned iterator is fail-fast.

Returns:Iterator<T>

an iterator over the elements in this list in proper sequence

Annotations
@Override
listIteratorback to summary
public ListIterator<T> listIterator()

Overrides java.util.ArrayList.listIterator.

Implements java.util.List.listIterator.

Doc from java.util.ArrayList.listIterator.

Returns a list iterator over the elements in this list (in proper sequence).

The returned list iterator is fail-fast.

Returns:ListIterator<T>

Doc from java.util.List.listIterator.

a list iterator over the elements in this list (in proper sequence)

Annotations
@Override
makeUnmodifiableback to summary
pack-priv void makeUnmodifiable()

Make this list unmodifiable.

removeback to summary
public boolean remove(final Object o)

Overrides java.util.ArrayList.remove.

Implements java.util.List.remove, java.util.Collection.remove.

Doc from java.util.ArrayList.remove.

Removes the first occurrence of the specified element from this list, if it is present. If the list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that Objects.equals(o, get(i)) (if such an element exists). Returns true if this list contained the specified element (or equivalently, if this list changed as a result of the call).

Parameters
o:Object

element to be removed from this list, if present

Returns:boolean

true if this list contained the specified element

Annotations
@Override
removeback to summary
public T remove(final int index)

Overrides java.util.ArrayList.remove.

Implements java.util.List.remove.

Doc from java.util.ArrayList.remove.

Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).

Parameters
index:int

the index of the element to be removed

Returns:T

the element that was removed from the list

Annotations
@Override
removeAllback to summary
public boolean removeAll(final Collection<?> c)

Overrides java.util.ArrayList.removeAll.

Implements java.util.List.removeAll, java.util.Collection.removeAll.

Doc from java.util.ArrayList.removeAll.

Removes from this list all of its elements that are contained in the specified collection.

Parameters
c:Collection<?>

collection containing elements to be removed from this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
retainAllback to summary
public boolean retainAll(final Collection<?> c)

Overrides java.util.ArrayList.retainAll.

Implements java.util.List.retainAll, java.util.Collection.retainAll.

Doc from java.util.ArrayList.retainAll.

Retains only the elements in this list that are contained in the specified collection. In other words, removes from this list all of its elements that are not contained in the specified collection.

Parameters
c:Collection<?>

collection containing elements to be retained in this list

Returns:boolean

true if this list changed as a result of the call

Annotations
@Override
setback to summary
public T set(final int index, final T element)

Overrides java.util.ArrayList.set.

Implements java.util.List.set.

Doc from java.util.ArrayList.set.

Replaces the element at the specified position in this list with the specified element.

Parameters
index:int

index of the element to replace

element:T

element to be stored at the specified position

Returns:T

the element previously at the specified position

Annotations
@Override