public Iterator getPrefixes(String uri) { //create an arraylist that contains the relevant prefixes String[] uris = (String[])uriStack.toArray(new String[uriStack.size()]); ArrayList tempList = new ArrayList(); for (int i = 0; i < uris.length; i++) { if (uris[i].equals(uri)) { tempList.add(prefixStack.get(i)); //we assume that array conversion preserves the order } } //by now all the relevant prefixes are collected //make a new iterator and provide a wrapper iterator to //obey the contract on the API return new WrappingIterator(tempList.iterator()); }
public Iterator getPrefixes(String uri) { //create an arraylist that contains the relevant prefixes String[] uris = (String[])uriStack.toArray(new String[uriStack.size()]); ArrayList tempList = new ArrayList(); for (int i = 0; i < uris.length; i++) { if (uris[i].equals(uri)) { tempList.add(prefixStack.get(i)); //we assume that array conversion preserves the order } } //by now all the relevant prefixes are collected //make a new iterator and provide a wrapper iterator to //obey the contract on the API return new WrappingIterator(tempList.iterator()); }