Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MrNavaStar committed Jul 16, 2024
1 parent f15a403 commit ef3f90d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/java/me/mrnavastar/sqlib/api/DataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import me.mrnavastar.sqlib.impl.SQLConnection;

import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;

/**
Expand Down Expand Up @@ -61,11 +62,11 @@ public DataContainer getOrCreateContainer(int id) {
* @param onCreate A function that gets run only when the container is created. This is useful for setting things
* such as a container id or other elements that are only set once.
*/
public DataContainer getOrCreateContainer(int id, Function<DataContainer, Void> onCreate) {
public DataContainer getOrCreateContainer(int id, Consumer<DataContainer> onCreate) {
DataContainer container = getContainer(id);
if (container != null) return container;
container = createContainer();
onCreate.apply(container);
onCreate.accept(container);
return container;
}

Expand All @@ -83,11 +84,11 @@ public DataContainer getOrCreateContainer(@NonNull String field, @NonNull Object
* @param onCreate A function that gets run only when the container is created. This is useful for setting things
* such as a container id or other elements that are only set once.
*/
public DataContainer getOrCreateContainer(@NonNull String field, @NonNull Object value, Function<DataContainer, Void> onCreate) {
public DataContainer getOrCreateContainer(@NonNull String field, @NonNull Object value, Consumer<DataContainer> onCreate) {
DataContainer container = getContainer(field, value);
if (container != null) return container;
container = createContainer();
onCreate.apply(container);
onCreate.accept(container);
return container;
}

Expand Down

0 comments on commit ef3f90d

Please sign in to comment.