@Override public E intern(E sample) {
    E canonical = map.get(sample);
    if (canonical != null) {
      return canonical;
    }

    var value = map.putIfAbsent(sample, sample);
    return (value == null) ? sample : value;
  }
@Test
  public void intern_weak_cleanup() {
    var interner = (WeakInterner<Int>) Interner.<Int>newWeakInterner();
    interner.cache.drainStatus = BoundedLocalCache.REQUIRED;

    var canonical = new Int(1);
    var interned1 = interner.intern(canonical);
    assertThat(interned1).isSameInstanceAs(canonical);
    assertThat(interner.cache.drainStatus).isEqualTo(BoundedLocalCache.IDLE);

    interner.cache.drainStatus = BoundedLocalCache.REQUIRED;
    var interned2 = interner.intern(canonical);
    assertThat(interned2).isSameInstanceAs(canonical);
    assertThat(interner.cache.drainStatus).isEqualTo(BoundedLocalCache.IDLE);
  }