Package com.ptsmods.mysqlw.collection
Class DbSet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
com.ptsmods.mysqlw.collection.DbSet<E>
- All Implemented Interfaces:
DbCollection,Iterable<E>,Collection<E>,Set<E>
-
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanaddAll(Collection<? extends E> c) addAllAsync(@NotNull Collection<? extends E> c) voidclear()booleanbooleancontainsAll(Collection<?> c) containsAllAsync(@NotNull Collection<?> c) @NotNull CompletableFuture<Boolean>getDb()@NotNull BiFunction<String,DbCollection, E> @NotNull BiFunction<E,DbCollection, String> getName()static <E> DbSet<E>Gets a set from cache or creates a new one.static <E> DbSet<E>getSet(@NotNull Database db, @NotNull String name, @NotNull BiFunction<E, DbCollection, String> elementToString, @NotNull BiFunction<String, DbCollection, E> elementFromString) Gets a set from cache or creates a new one.getTable()booleanisEmpty()@NotNull CompletableFuture<Boolean>iterator()@NotNull CompletableFuture<Iterator<E>>static <E> DbSet<E>parseString(@NotNull Database db, @NotNull String s, @NotNull BiFunction<E, DbCollection, String> elementToString, @NotNull BiFunction<String, DbCollection, E> elementFromString) Parses a String representation of a DbSet into a DbSet.booleanbooleanremoveAll(Collection<?> c) removeAllAsync(@NotNull Collection<?> c) booleanretainAll(Collection<?> c) retainAllAsync(@NotNull Collection<?> c) <T> CompletableFuture<T>voidsetExecutor(Executor executor) intsize()@NotNull CompletableFuture<Integer>@NotNull Object[]toArray()<T> @NotNull T[]toArray(@NotNull T[] a) <T> @NotNull CompletableFuture<T[]>toArrayAsync(@NotNull T[] a) @NotNull CompletableFuture<Set<E>>toString()Methods inherited from class java.util.AbstractSet
equals, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Method Details
-
parseString
public static <E> DbSet<E> parseString(@NotNull @NotNull Database db, @NotNull @NotNull String s, @NotNull @NotNull BiFunction<E, DbCollection, String> elementToString, @NotNull @NotNull BiFunction<String, DbCollection, E> elementFromString) Parses a String representation of a DbSet into a DbSet.- Type Parameters:
E- The type of the elements in this set.- Parameters:
db- The database this set belongs to. Used when creating a new set.s- The String to parse.elementToString- The function used to convert an element of this set into a String. Used when creating a new set.elementFromString- The function used to convert an element of this set into a String. Used when creating a new set.- Returns:
- A new DbSet or a cached one if available.
-
getSet
public static <E> DbSet<E> getSet(@NotNull @NotNull Database db, @NotNull @NotNull String name, @NotNull @NotNull Class<E> type) Gets a set from cache or creates a new one.- Type Parameters:
E- The type of the elements in this set.- Parameters:
db- The database this set belongs to. Used when creating a new map.name- The name of this set.type- The Class of type E if you've registered a type converter onDbCF. Used when creating a new set.- Returns:
- A new DbSet or a cached one if available.
-
getSet
public static <E> DbSet<E> getSet(@NotNull @NotNull Database db, @NotNull @NotNull String name, @NotNull @NotNull BiFunction<E, DbCollection, String> elementToString, @NotNull @NotNull BiFunction<String, DbCollection, E> elementFromString) Gets a set from cache or creates a new one.- Type Parameters:
E- The type of the elements in this set.- Parameters:
db- The database this map belongs to. Used when creating a new map.name- The name of this set.elementToString- The function used to convert an element of this set into a String. Used when creating a new set.elementFromString- The function used to convert an element of this set into a String. Used when creating a new set.- Returns:
- A new DbSet or a cached one if available.
-
setExecutor
-
getExecutor
-
runAsync
-
runAsync
-
size
public int size()- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
sizeAsync
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceSet<E>- Overrides:
isEmptyin classAbstractCollection<E>
-
isEmptyAsync
-
contains
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
containsAsync
-
iterator
-
iteratorAsync
-
toArray
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceSet<E>- Overrides:
toArrayin classAbstractCollection<E>
-
toArrayAsync
-
toArray
@NotNull public <T> @NotNull T[] toArray(@NotNull @NotNull T[] a) - Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceSet<E>- Overrides:
toArrayin classAbstractCollection<E>
-
toArrayAsync
-
add
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollection<E>
-
addAsync
-
remove
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classAbstractCollection<E>
-
removeAsync
-
containsAll
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>- Overrides:
containsAllin classAbstractCollection<E>
-
containsAllAsync
-
addAll
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceSet<E>- Overrides:
addAllin classAbstractCollection<E>
-
addAllAsync
-
retainAll
- Specified by:
retainAllin interfaceCollection<E>- Specified by:
retainAllin interfaceSet<E>- Overrides:
retainAllin classAbstractCollection<E>
-
retainAllAsync
-
removeAll
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classAbstractSet<E>
-
removeAllAsync
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classAbstractCollection<E>
-
clearAsync
-
getDb
- Specified by:
getDbin interfaceDbCollection- Returns:
- The database this collection works with.
-
getTable
- Specified by:
getTablein interfaceDbCollection- Returns:
- The table this collection works with.
-
getName
- Specified by:
getNamein interfaceDbCollection- Returns:
- The name of this collection. Used to cache and parse from Strings.
-
toString
- Overrides:
toStringin classAbstractCollection<E>
-
toHashSet
-
toHashSetAsync
-
getElementToString
-
getElementFromString
-