- try (LockHolder locker = Data.transactions.lockForWriting()) {
- List<TransactionListItem> transactions = Data.transactions.getList();
- TransactionListItem target = new TransactionListItem(date, true);
- int found = Collections.binarySearch(transactions, target,
- new TransactionListItemComparator());
- if (found >= 0)
- return found;
- else
- return 1 - found;
+ TransactionListItem target = new TransactionListItem(date, true);
+ int found =
+ Collections.binarySearch(transactions, target, new TransactionListItemComparator());
+ if (found >= 0)
+ return found;
+ else
+ return -1 - found;
+ }
+
+ public static class Params {
+ public final MainModel model;
+ public final SimpleDate date;
+ public Params(@NotNull MainModel model, @NotNull SimpleDate date) {
+ this.model = model;
+ this.date = date;