1 7 8 package com.ibm.icu.impl; 9 10 import java.util.NoSuchElementException ; 11 12 import com.ibm.icu.util.UResourceTypeMismatchException; 13 14 15 39 public class ICUResourceBundleIterator{ 40 private ICUResourceBundle bundle; 41 private int index = 0; 42 private int size = 0; 43 50 public ICUResourceBundleIterator(ICUResourceBundle bndl){ 51 bundle = bndl; 52 size = bundle.getSize(); 53 } 54 55 61 public ICUResourceBundle next()throws NoSuchElementException { 62 if(index<size){ 63 return bundle.get(index++); 64 } 65 throw new NoSuchElementException (); 66 } 67 74 public String nextString()throws NoSuchElementException , UResourceTypeMismatchException{ 75 if(index<size){ 76 return bundle.getString(index++); 77 } 78 throw new NoSuchElementException (); 79 } 80 81 85 public void reset(){ 86 index = 0; 88 } 89 90 95 public boolean hasNext(){ 96 return index < size; 97 } 98 } | Popular Tags |