1 7 34 35 package com.sun.tools.example.debug.tty; 36 37 import com.sun.jdi.ThreadGroupReference; 38 import com.sun.jdi.ThreadReference; 39 import java.util.List ; 40 import java.util.Iterator ; 41 42 class ThreadIterator implements Iterator { 43 Iterator it = null; 44 ThreadGroupIterator tgi; 45 46 ThreadIterator(ThreadGroupReference tg) { 47 tgi = new ThreadGroupIterator(tg); 48 } 49 50 ThreadIterator(List tgl) { 51 tgi = new ThreadGroupIterator(tgl); 52 } 53 54 ThreadIterator() { 55 tgi = new ThreadGroupIterator(); 56 } 57 58 public boolean hasNext() { 59 while (it == null || !it.hasNext()) { 60 if (!tgi.hasNext()) { 61 return false; } 63 it = tgi.nextThreadGroup().threads().iterator(); 64 } 65 return true; 66 } 67 68 public Object next() { 69 return it.next(); 70 } 71 72 public ThreadReference nextThread() { 73 return (ThreadReference)next(); 74 } 75 76 public void remove() { 77 throw new UnsupportedOperationException (); 78 } 79 } 80 81 82 | Popular Tags |