Package io.papermc.paper.util

# Class TransformingRandomAccessList<F,T>

java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<T>
io.papermc.paper.util.TransformingRandomAccessList<F,T>

Type Parameters:
  `F` - backing list element type
  `T` - transformed list element type

All Implemented Interfaces:
  `Iterable<T>`, `Collection<T>`, `List<T>`, `RandomAccess`

public final class TransformingRandomAccessList<F,T> extends AbstractList<T> implements RandomAccess
Modified version of the Guava class with the same name to support add operations.

## Field Summary

### Fields inherited from class java.util.AbstractList

`modCount`

## Constructor Summary

Constructors
Constructor
Description
`TransformingRandomAccessList(@NonNull List<F> fromList, @NonNull Function<? super F,? extends T> toFunction, @NonNull Function<? super T,? extends F> fromFunction)`
Create a new `TransformingRandomAccessList`.

## Method Summary

Modifier and Type
Method
Description
`void`
`add(int i, T t)`
`void`
`clear()`
`T`
`get(int index)`
`boolean`
`isEmpty()`
`@NotNull Iterator<T>`
`iterator()`
`@NotNull ListIterator<T>`
`listIterator(int index)`
`T`
`remove(int index)`
`boolean`
`removeIf(Predicate<? super T> filter)`
`T`
`set(int i, T t)`
`int`
`size()`

### Methods inherited from class java.util.AbstractList

`add, addAll, equals, hashCode, indexOf, lastIndexOf, listIterator, removeRange, subList`

### Methods inherited from class java.util.AbstractCollection

`addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface java.util.Collection

`parallelStream, stream, toArray`

### Methods inherited from interface java.lang.Iterable

`forEach`

### Methods inherited from interface java.util.List

`addAll, contains, containsAll, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray`

## Constructor Details

### TransformingRandomAccessList

public TransformingRandomAccessList(@NonNull List<F> fromList, @NonNull Function<? super F,? extends T> toFunction, @NonNull Function<? super T,? extends F> fromFunction)
Create a new `TransformingRandomAccessList`.

Parameters:
  `fromList` - backing list
  `toFunction` - function mapping backing list element type to transformed list element type
  `fromFunction` - function mapping transformed list element type to backing list element type

## Method Details

### clear

public void clear()

Specified by:
  `clear` in interface `Collection<F>`
Specified by:
  `clear` in interface `List<F>`
Overrides:
  `clear` in class `AbstractList<T>`

### get

public T get(int index)

Specified by:
  `get` in interface `List<F>`
Specified by:
  `get` in class `AbstractList<T>`

### iterator

@NotNull public @NotNull Iterator<T> iterator()

Specified by:
  `iterator` in interface `Collection<F>`
Specified by:
  `iterator` in interface `Iterable<F>`
Specified by:
  `iterator` in interface `List<F>`
Overrides:
  `iterator` in class `AbstractList<T>`

### listIterator

@NotNull public @NotNull ListIterator<T> listIterator(int index)

Specified by:
  `listIterator` in interface `List<F>`
Overrides:
  `listIterator` in class `AbstractList<T>`

### isEmpty

public boolean isEmpty()

Specified by:
  `isEmpty` in interface `Collection<F>`
Specified by:
  `isEmpty` in interface `List<F>`
Overrides:
  `isEmpty` in class `AbstractCollection<T>`

### removeIf

public boolean removeIf(Predicate<? super T> filter)

Specified by:
  `removeIf` in interface `Collection<F>`

### remove

public T remove(int index)

Specified by:
  `remove` in interface `List<F>`
Overrides:
  `remove` in class `AbstractList<T>`

### size

public int size()

Specified by:
  `size` in interface `Collection<F>`
Specified by:
  `size` in interface `List<F>`
Specified by:
  `size` in class `AbstractCollection<T>`

### set

public T set(int i, T t)

Specified by:
  `set` in interface `List<F>`
Overrides:
  `set` in class `AbstractList<T>`

### add

public void add(int i, T t)

Specified by:
  `add` in interface `List<F>`
Overrides:
  `add` in class `AbstractList<T>`