1 4 package com.tc.util; 5 6 import com.tc.object.bytecode.ManagerUtil; 7 8 import java.util.Iterator ; 9 import java.util.Set ; 10 11 15 public class SetIteratorWrapper implements Iterator { 16 private final Set set; 17 private final Iterator iterator; 18 private Object current; 19 20 public SetIteratorWrapper(Iterator iterator, Set set) { 21 this.set = set; 22 this.iterator = iterator; 23 } 24 25 public boolean hasNext() { 26 return this.iterator.hasNext(); 27 } 28 29 public Object next() { 30 current = iterator.next(); 31 return current; 32 } 33 34 public void remove() { 35 ManagerUtil.checkWriteAccess(set); 36 iterator.remove(); 37 ManagerUtil.logicalInvoke(set, "remove(Ljava/lang/Object;)Z", new Object [] { current }); 38 } 39 } 40 | Popular Tags |