@Test public void testClear() { ViewModelStore store = new ViewModelStore(); TestViewModel viewModel1 = new TestViewModel(); TestViewModel viewModel2 = new TestViewModel(); store.put("a", viewModel1); store.put("b", viewModel2); assertThat(viewModel1.mCleared, is(false)); assertThat(viewModel2.mCleared, is(false)); store.clear(); assertThat(viewModel1.mCleared, is(true)); assertThat(viewModel2.mCleared, is(true)); assertThat(store.get("a"), nullValue()); assertThat(store.get("b"), nullValue()); }
public final void clear() { for (ViewModel vm : mMap.values()) { vm.onCleared(); } mMap.clear(); }
ViewModelStore { public final void clear() { for (ViewModel vm : mMap.values()) { vm.onCleared(); } mMap.clear(); } }
ViewModelStore { public final void clear() { for (ViewModel vm : mMap.values()) { vm.onCleared(); } mMap.clear(); }  }
ViewModelStore { public final void clear() { for (ViewModel vm : mMap.values()) { vm.onCleared(); } mMap.clear(); }  final void clear(); }
ViewModelStore { public final void clear() { for (ViewModel vm : mMap.values()) { vm.onCleared(); } mMap.clear(); }  final void clear();  }