Code example for HashSet

Methods: add

0
        cluster1.addBroker(2, new Broker(2, "meta://host2:8123"));
        Assert.assertEquals(3, cluster1.size());
 
        cluster1.remove(1);
        Assert.assertEquals(1, cluster1.size());
        Set<Broker> brokers = new HashSet<Broker>();
        cluster1.addBroker(4, brokers);
        Assert.assertEquals(1, cluster1.size());
        //Á½¸öbrokerÊÇÏàͬµÄ,Ï൱ÓÚÒ»¸ö 
        brokers.add(new Broker(4, "meta://host4:8123"));
        brokers.add(new Broker(4, "meta://host4:8123"));
        cluster1.addBroker(4, brokers);
        Assert.assertEquals(2, cluster1.size());
        brokers.add(new Broker(4, "meta://host44:8123?isSlave=true"));
        cluster1.addBroker(4, brokers);
        Assert.assertEquals(3, cluster1.size());
 
        Assert.assertFalse(cluster1.getMasterBroker(4).isSlave());
 
    }