| 667 | } |
| 668 | |
| 669 | public final boolean tryAdd(@NotNull K key, @NotNull V value) { |
| 670 | //noinspection ConstantValue |
| 671 | if (value == null) |
| 672 | throw new IllegalArgumentException("value is null"); |
| 673 | if (get(key) != null) |
| 674 | return false; |
| 675 | |
| 676 | var currentT = Transaction.getCurrent(); |
| 677 | assert currentT != null; |
| 678 | |
| 679 | var tkey = new TableKey(getId(), key); |
| 680 | var cr = currentT.getRecordAccessed(tkey); |
| 681 | //noinspection DataFlowIssue |
| 682 | value.initRootInfoWithRedo(cr.atomicTupleRecord.record.createRootInfoIfNeed(tkey), null); |
| 683 | cr.put(currentT, value); |
| 684 | return true; |
| 685 | } |
| 686 | |
| 687 | public final void insert(@NotNull K key, @NotNull V value) { |
| 688 | if (!tryAdd(key, value)) { |