getRecentDocumentを非同期に

This commit is contained in:
r-ca 2024-01-20 23:17:31 +09:00
parent 4ab13508c4
commit 4e5aab276a
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -2,7 +2,9 @@ package one.nem.lacerta.data.impl;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import javax.inject.Inject;
@ -28,7 +30,8 @@ public class LacertaLibraryImpl implements LacertaLibrary {
}
@Override
public ArrayList<ListItem> getRecentDocument(int limit) {
public CompletableFuture<ArrayList<ListItem>> getRecentDocument(int limit) {
return CompletableFuture.supplyAsync(() -> {
List<DocumentEntity> documentEntities = database.documentDao().getRecentDocument(limit);
ArrayList<ListItem> listItems = new ArrayList<>();
@ -40,11 +43,13 @@ public class LacertaLibraryImpl implements LacertaLibrary {
listItem.setItemId(documentEntity.id);
listItems.add(listItem);
}
return listItems;
});
}
@Override
public ArrayList<ListItem> getRecentDocument(int limit, int offset) {
public CompletableFuture<ArrayList<ListItem>> getRecentDocument(int limit, int offset) {
return null; // TODO-rca: Implement
}