@Test public void removeAll() throws Exception { ProviderGroup pg = new ProviderGroup("xxx", Arrays.asList(ProviderHelper.toProviderInfo("127.0.0.1:12201"), ProviderHelper.toProviderInfo("127.0.0.1:12202"), ProviderHelper.toProviderInfo("127.0.0.1:12203"), ProviderHelper.toProviderInfo("127.0.0.1:12204"))); Assert.assertTrue(pg.size() == 4); pg.removeAll(null); Assert.assertTrue(pg.size() == 4); pg.removeAll(new ArrayList<ProviderInfo>()); Assert.assertTrue(pg.size() == 4); pg.removeAll(Arrays.asList(ProviderHelper.toProviderInfo("127.0.0.1:12205"), ProviderHelper.toProviderInfo("127.0.0.1:12206"))); Assert.assertTrue(pg.size() == 4); pg.removeAll(Arrays.asList(ProviderHelper.toProviderInfo("127.0.0.1:12204"), ProviderHelper.toProviderInfo("127.0.0.1:12205"))); Assert.assertTrue(pg.size() == 3); pg.removeAll(Arrays.asList(ProviderHelper.toProviderInfo("127.0.0.1:12202"), ProviderHelper.toProviderInfo("127.0.0.1:12203"))); Assert.assertTrue(pg.size() == 1); pg.removeAll(Arrays.asList(ProviderHelper.toProviderInfo("127.0.0.1:12202"), ProviderHelper.toProviderInfo("127.0.0.1:12203"))); Assert.assertTrue(pg.size() == 1); }
public ProviderGroup removeAll(List<ProviderInfo> providerInfos) { if (CommonUtils.isEmpty(providerInfos)) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(this.providerInfos); tmp.removeAll(providerInfos); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; }
ProviderGroup { public ProviderGroup removeAll(List<ProviderInfo> providerInfos) { if (CommonUtils.isEmpty(providerInfos)) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(this.providerInfos); tmp.removeAll(providerInfos); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; } }
ProviderGroup { public ProviderGroup removeAll(List<ProviderInfo> providerInfos) { if (CommonUtils.isEmpty(providerInfos)) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(this.providerInfos); tmp.removeAll(providerInfos); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; } ProviderGroup();  ProviderGroup(String name);  ProviderGroup(String name, List<ProviderInfo> providerInfos);  ProviderGroup(List<ProviderInfo> providerInfos); }
ProviderGroup { public ProviderGroup removeAll(List<ProviderInfo> providerInfos) { if (CommonUtils.isEmpty(providerInfos)) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(this.providerInfos); tmp.removeAll(providerInfos); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; } ProviderGroup();  ProviderGroup(String name);  ProviderGroup(String name, List<ProviderInfo> providerInfos);  ProviderGroup(List<ProviderInfo> providerInfos); String getName(); List<ProviderInfo> getProviderInfos(); void setProviderInfos(List<ProviderInfo> providerInfos); boolean isEmpty(); int size(); ProviderGroup add(ProviderInfo providerInfo); ProviderGroup addAll(Collection<ProviderInfo> providerInfos); ProviderGroup remove(ProviderInfo providerInfo); ProviderGroup removeAll(List<ProviderInfo> providerInfos); @Override String toString(); }
ProviderGroup { public ProviderGroup removeAll(List<ProviderInfo> providerInfos) { if (CommonUtils.isEmpty(providerInfos)) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(this.providerInfos); tmp.removeAll(providerInfos); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; } ProviderGroup();  ProviderGroup(String name);  ProviderGroup(String name, List<ProviderInfo> providerInfos);  ProviderGroup(List<ProviderInfo> providerInfos); String getName(); List<ProviderInfo> getProviderInfos(); void setProviderInfos(List<ProviderInfo> providerInfos); boolean isEmpty(); int size(); ProviderGroup add(ProviderInfo providerInfo); ProviderGroup addAll(Collection<ProviderInfo> providerInfos); ProviderGroup remove(ProviderInfo providerInfo); ProviderGroup removeAll(List<ProviderInfo> providerInfos); @Override String toString();  }