public boolean insertOrReplace(E entry, Predicate<E> entryTest) {
        AtomicBoolean updated = new AtomicBoolean(false);
        map.compute(checkNotNull(entry), (k, v) -> {
            if (v == null || entryTest.test(v)) {
                updated.set(true);
                return entry;
            }
            return v;
        });
        return updated.get();
    }
@Test
    public void testInsertOrReplace() {
        ExtendedSet<TestValue> set = new ExtendedSet<>(Maps.newConcurrentMap());
        TestValue small = new TestValue("foo", 1);
        TestValue medium = new TestValue("foo", 2);
        TestValue large = new TestValue("foo", 3);
        // input TestValue will replace existing TestValue if its value2() is greater
        // than existing entry's value2()
        assertTrue(set.insertOrReplace(small, existing -> existing.value2() < small.value2()));
        assertTrue(set.insertOrReplace(large, existing -> existing.value2() < large.value2()));
        assertFalse(set.insertOrReplace(medium, existing -> existing.value2() < medium.value2()));

        assertTrue(set.contains(small));
        assertTrue(set.contains(medium));
        assertTrue(set.contains(large));
    }