@Test public void add() throws Exception { ProviderGroup pg = new ProviderGroup("xxx", null); Assert.assertTrue(pg.size() == 0); pg.add(null); Assert.assertTrue(pg.size() == 0); pg.add(ProviderHelper.toProviderInfo("127.0.0.1:12200")); Assert.assertTrue(pg.size() == 1); pg.add(ProviderHelper.toProviderInfo("127.0.0.1:12201")); Assert.assertTrue(pg.size() == 2); pg.add(ProviderHelper.toProviderInfo("127.0.0.1:12200")); Assert.assertTrue(pg.size() == 2); }
public ProviderGroup add(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.add(providerInfo); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; }
ProviderGroup { public ProviderGroup add(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.add(providerInfo); this.providerInfos = new ArrayList<ProviderInfo>(tmp); return this; } }
ProviderGroup { public ProviderGroup add(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.add(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 add(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.add(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 add(ProviderInfo providerInfo) { if (providerInfo == null) { return this; } ConcurrentHashSet<ProviderInfo> tmp = new ConcurrentHashSet<ProviderInfo>(providerInfos); tmp.add(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();  }