// "Use removal by object" "true-preview" import java.util.List; class Test { void test(List list, String key) { int idx = list.indexOf(key); list.remove(idx); } }