Class PersistentList<T>
java.lang.Object
io.github.blyznytsiaorg.bibernate.collection.PersistentList<T>
- Type Parameters:
T- the type of elements in the list
- All Implemented Interfaces:
Iterable<T>,Collection<T>,List<T>,SequencedCollection<T>
Represents a persistent list that lazily initializes its internal list using a supplier.
- Since:
- 1.0
- Author:
- Blyzhnytsia Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionSupplier responsible for providing the underlying collection when needed.The internal list that holds the elements of the PersistentList. -
Constructor Summary
ConstructorsConstructorDescriptionPersistentList(Supplier<List<?>> collectionSupplier) Constructs a new PersistentList with the specified collection supplier. -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanbooleanaddAll(int index, @NotNull Collection<? extends T> c) booleanaddAll(@NotNull Collection<? extends T> c) voidclear()booleanbooleancontainsAll(@NotNull Collection<?> c) static <E> List<E> copyOf(Collection<? extends E> coll) booleanvoidget(int index) Retrieves the internal list, initializing it if necessary.inthashCode()intbooleanisEmpty()iterator()int@NotNull ListIterator<T> @NotNull ListIterator<T> listIterator(int index) static <E> List<E> of()static <E> List<E> of(E e1) static <E> List<E> of(E... elements) static <E> List<E> of(E e1, E e2) static <E> List<E> of(E e1, E e2, E e3) static <E> List<E> of(E e1, E e2, E e3, E e4) static <E> List<E> of(E e1, E e2, E e3, E e4, E e5) static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6) static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) static <E> List<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) remove(int index) booleanbooleanremoveAll(@NotNull Collection<?> c) booleanvoidreplaceAll(UnaryOperator<T> operator) booleanretainAll(@NotNull Collection<?> c) intsize()voidsort(Comparator<? super T> c) stream()subList(int fromIndex, int toIndex) @NotNull Object[]toArray()<T1> T1[]toArray(IntFunction<T1[]> generator) <T1> T1[]toArray(T1[] a) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, reversed
-
Field Details
-
collectionSupplier
Supplier responsible for providing the underlying collection when needed. -
internalList
The internal list that holds the elements of the PersistentList.
-
-
Constructor Details
-
PersistentList
Constructs a new PersistentList with the specified collection supplier.- Parameters:
collectionSupplier- the supplier used to lazily initialize the internal list
-
-
Method Details
-
getInternalList
Retrieves the internal list, initializing it if necessary.- Returns:
- the internal list
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
-
iterator
-
toArray
-
toArray
@NotNull public <T1> T1[] toArray(@NotNull T1[] a) -
add
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceList<T>
-
addAll
-
addAll
-
removeAll
-
retainAll
-
replaceAll
- Specified by:
replaceAllin interfaceList<T>
-
sort
-
clear
public void clear() -
equals
-
hashCode
public int hashCode() -
get
-
set
-
add
-
remove
-
indexOf
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<T>
-
listIterator
- Specified by:
listIteratorin interfaceList<T>
-
listIterator
- Specified by:
listIteratorin interfaceList<T>
-
subList
-
spliterator
- Specified by:
spliteratorin interfaceCollection<T>- Specified by:
spliteratorin interfaceIterable<T>- Specified by:
spliteratorin interfaceList<T>
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
of
-
copyOf
-
toArray
- Specified by:
toArrayin interfaceCollection<T>
-
removeIf
- Specified by:
removeIfin interfaceCollection<T>
-
stream
- Specified by:
streamin interfaceCollection<T>
-
parallelStream
- Specified by:
parallelStreamin interfaceCollection<T>
-
forEach
-