private void collectInstanceNames(
     Set<String> setLongInstanceNames,
     Iterator<HazelcastInstanceAwareInstance> it,
     Instance.InstanceType type) {
   int count = 0;
   while (it.hasNext()) {
     HazelcastInstanceAwareInstance proxyObject = it.next();
     if (proxyObject.getInstanceType() == type) {
       if (count < maxVisibleInstanceCount) {
         if (type.isMap()) {
           MProxy mapProxy = (MProxy) proxyObject;
           if (instanceFilterMap.visible(mapProxy.getName())) {
             setLongInstanceNames.add(mapProxy.getLongName());
             count++;
           }
         } else if (type.isQueue()) {
           QProxy qProxy = (QProxy) proxyObject;
           if (instanceFilterQueue.visible(qProxy.getName())) {
             setLongInstanceNames.add(qProxy.getLongName());
             count++;
           }
         } else if (type.isTopic()) {
           TopicProxy topicProxy = (TopicProxy) proxyObject;
           if (instanceFilterTopic.visible(topicProxy.getName())) {
             setLongInstanceNames.add(topicProxy.getLongName());
             count++;
           }
         } else if (type.isAtomicNumber()) {
           AtomicNumberProxy atomicLongProxy = (AtomicNumberProxy) proxyObject;
           if (instanceFilterAtomicNumber.visible(atomicLongProxy.getName())) {
             setLongInstanceNames.add(atomicLongProxy.getLongName());
             count++;
           }
         } else if (type.isCountDownLatch()) {
           CountDownLatchProxy cdlProxy = (CountDownLatchProxy) proxyObject;
           if (instanceFilterCountDownLatch.visible(cdlProxy.getName())) {
             setLongInstanceNames.add(cdlProxy.getLongName());
             count++;
           }
         } else if (type.isSemaphore()) {
           SemaphoreProxy semaphoreProxy = (SemaphoreProxy) proxyObject;
           if (instanceFilterSemaphore.visible(semaphoreProxy.getName())) {
             setLongInstanceNames.add(semaphoreProxy.getLongName());
             count++;
           }
         }
       }
       it.remove();
     }
   }
 }