@Test public void remove() 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"))); Assert.assertTrue(pg.size() == 3); pg.remove(null); Assert.assertTrue(pg.size() == 3); pg.remove(ProviderHelper.toProviderInfo("127.0.0.1:12204")); Assert.assertTrue(pg.size() == 3); pg.remove(ProviderHelper.toProviderInfo("127.0.0.1:12203")); Assert.assertTrue(pg.size() == 2); pg.remove(ProviderHelper.toProviderInfo("127.0.0.1:12203")); Assert.assertTrue(pg.size() == 2); pg.remove(ProviderHelper.toProviderInfo("127.0.0.1:12202")); Assert.assertTrue(pg.size() == 1); }
public ProviderGroup remove(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.remove(providerInfo); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; }
ProviderGroup { public ProviderGroup remove(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.remove(providerInfo); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; } }
ProviderGroup { public ProviderGroup remove(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.remove(providerInfo); 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 remove(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.remove(providerInfo); 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 remove(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.remove(providerInfo); 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();  }