Package com.ptsmods.mysqlw.collection
Class DbList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
com.ptsmods.mysqlw.collection.DbList<E>
- All Implemented Interfaces:
DbCollection
,Iterable<E>
,Collection<E>
,List<E>
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Method Summary
Modifier and TypeMethodDescriptionvoid
boolean
boolean
addAll
(int index, @NotNull Collection<? extends E> c) boolean
addAll
(@NotNull Collection<? extends E> c) addAllAsync
(int index, @NotNull Collection<? extends E> c) addAllAsync
(@NotNull Collection<? extends E> c) void
clear()
boolean
boolean
containsAll
(@NotNull Collection<?> c) containsAllAsync
(@NotNull Collection<?> c) @NotNull CompletableFuture<Boolean>
get
(int index) getAsync
(int index) @NotNull Database
getDb()
static <E> DbList<E>
Parses a String representation of a DbList into a DbList.static <E> DbList<E>
getList
(Database db, String name, BiFunction<E, DbCollection, String> elementToString, BiFunction<String, DbCollection, E> elementFromString) Parses a String representation of a DbList into a DbList.@NotNull String
getName()
@NotNull String
getTable()
int
boolean
isEmpty()
@NotNull CompletableFuture<Boolean>
iterator()
@NotNull CompletableFuture<Iterator<E>>
int
@NotNull ListIterator<E>
@NotNull ListIterator<E>
listIterator
(int index) @NotNull CompletableFuture<ListIterator<E>>
@NotNull CompletableFuture<ListIterator<E>>
listIteratorAsync
(int index) static <E> DbList<E>
parseString
(Database db, String s, BiFunction<E, DbCollection, String> elementToString, BiFunction<String, DbCollection, E> elementFromString) Parses a String representation of a DbList into a DbList.remove
(int index) boolean
boolean
removeAll
(@NotNull Collection<?> c) removeAllAsync
(@NotNull Collection<?> c) removeAsync
(int index) boolean
retainAll
(@NotNull Collection<?> c) retainAllAsync
(@NotNull Collection<?> c) <T> CompletableFuture<T>
void
setExecutor
(Executor executor) int
size()
@NotNull CompletableFuture<Integer>
subList
(int fromIndex, int toIndex) @NotNull CompletableFuture<List<E>>
subListAsync
(int fromIndex, int toIndex) @NotNull Object[]
toArray()
<T> @NotNull T[]
toArray
(@NotNull T[] a) <T> @NotNull CompletableFuture<T[]>
toArrayAsync
(@NotNull T[] a) toString()
Methods inherited from class java.util.AbstractList
equals, hashCode, removeRange
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
Method Details
-
parseString
public static <E> DbList<E> parseString(Database db, String s, BiFunction<E, DbCollection, String> elementToString, BiFunction<String, DbCollection, E> elementFromString) Parses a String representation of a DbList into a DbList.- Type Parameters:
E
- The type of the elements in this set.- Parameters:
db
- The database this list belongs to. Used when creating a new map.s
- The String to parse.elementToString
- The function used to convert an element of this list into a String. Used when creating a new list.elementFromString
- The function used to convert an element of this list into a String. Used when creating a new list.- Returns:
- A new DbList or a cached one if available.
-
getList
Parses a String representation of a DbList into a DbList.- Type Parameters:
E
- The type of the elements in this set.- Parameters:
db
- The database this list belongs to. Used when creating a new map.name
- The name of this list.type
- The Class of type E if you've registered a type converter onDbCF
. Used when creating a new list.- Returns:
- A new DbList or a cached one if available.
-
getList
public static <E> DbList<E> getList(Database db, String name, BiFunction<E, DbCollection, String> elementToString, BiFunction<String, DbCollection, E> elementFromString) Parses a String representation of a DbList into a DbList.- Type Parameters:
E
- The type of the elements in this set.- Parameters:
db
- The database this list belongs to. Used when creating a new map.name
- The name of this list.elementToString
- The function used to convert an element of this list into a String. Used when creating a new list.elementFromString
- The function used to convert an element of this list into a String. Used when creating a new list.- Returns:
- A new DbList or a cached one if available.
-
setExecutor
-
getExecutor
-
runAsync
-
runAsync
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceList<E>
- Specified by:
size
in classAbstractCollection<E>
-
sizeAsync
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceList<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
isEmptyAsync
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceList<E>
- Overrides:
contains
in classAbstractCollection<E>
-
containsAsync
-
iterator
-
iteratorAsync
-
toArray
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceList<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
toArrayAsync
-
toArray
@NotNull public <T> @NotNull T[] toArray(@NotNull @NotNull T[] a) - Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceList<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
toArrayAsync
-
add
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceList<E>
- Overrides:
add
in classAbstractList<E>
-
addAsync
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceList<E>
- Overrides:
remove
in classAbstractCollection<E>
-
removeAsync
-
containsAll
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceList<E>
- Overrides:
containsAll
in classAbstractCollection<E>
-
containsAllAsync
-
addAll
- Specified by:
addAll
in interfaceCollection<E>
- Specified by:
addAll
in interfaceList<E>
- Overrides:
addAll
in classAbstractCollection<E>
-
addAllAsync
-
addAll
-
addAllAsync
public CompletableFuture<Boolean> addAllAsync(int index, @NotNull @NotNull Collection<? extends E> c) -
removeAll
- Specified by:
removeAll
in interfaceCollection<E>
- Specified by:
removeAll
in interfaceList<E>
- Overrides:
removeAll
in classAbstractCollection<E>
-
removeAllAsync
-
retainAll
- Specified by:
retainAll
in interfaceCollection<E>
- Specified by:
retainAll
in interfaceList<E>
- Overrides:
retainAll
in classAbstractCollection<E>
-
retainAllAsync
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceList<E>
- Overrides:
clear
in classAbstractList<E>
-
clearAsync
-
get
-
getAsync
-
set
-
setAsync
-
add
-
addAsync
-
remove
-
removeAsync
-
indexOf
-
indexOfAsync
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<E>
- Overrides:
lastIndexOf
in classAbstractList<E>
-
lastIndexOfAsync
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in classAbstractList<E>
-
listIteratorAsync
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in classAbstractList<E>
-
listIteratorAsync
-
subList
-
subListAsync
-
toString
- Overrides:
toString
in classAbstractCollection<E>
-
getDb
- Specified by:
getDb
in interfaceDbCollection
- Returns:
- The database this collection works with.
-
getTable
- Specified by:
getTable
in interfaceDbCollection
- Returns:
- The table this collection works with.
-
getName
- Specified by:
getName
in interfaceDbCollection
- Returns:
- The name of this collection. Used to cache and parse from Strings.
-
toArrayList
-
toArrayListAsync
-
getElementFromString
-
getElementToString
-