added ordered Iterator for public key fetching.
@@ -466,6 +466,27 @@ public static PGPPublicKeyRingCollection removePublicKeyRing(
*/
public Iterator<PGPPublicKeyRing> iterator()
{
- return pubRings.values().iterator();
+ return new KeyRingIterator(order);
+ }
+
+ private class KeyRingIterator
+ implements Iterator
+ {
+ private final Iterator<Long> iterator;
+
+ KeyRingIterator(List<Long> ids)
+ {
+ this.iterator = ids.iterator();
+ }
+
+ public boolean hasNext()
+ {
+ return iterator.hasNext();
+ }
+
+ public Object next()
+ {
+ return pubRings.get(iterator.next());
+ }
}
}
