void (final @NotNull T item) { table.clearSelection(); Ref<T> ref; if (helper.hasModifiedItems()) { ref = Ref.create(); helper.process((modified, original) -> { if (item == original) { ref.set(modified); } return ref.isNull(); }); } else { ref = null; } table.addSelection(ref == null || ref.isNull() ? item : ref.get()); }