Index: base/android/java/src/org/chromium/base/RewindableIterator.java |
diff --git a/base/android/java/src/org/chromium/base/RewindableIterator.java b/base/android/java/src/org/chromium/base/RewindableIterator.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7f07b7240f1ef4feb535827d08dc160f302f89f9 |
--- /dev/null |
+++ b/base/android/java/src/org/chromium/base/RewindableIterator.java |
@@ -0,0 +1,22 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.base; |
+ |
+import java.util.Iterator; |
+ |
+/** |
+ * Extended iterator interface that provides rewind functionality. |
+ * |
+ * @param <E> The iterated type. |
+ */ |
+public interface RewindableIterator<E> extends Iterator<E> { |
+ /** |
+ * Rewind the iterator back to the beginning. |
+ * |
+ * If we need to iterate multiple times, we can avoid iterator object reallocation by using |
+ * this method. |
+ */ |
+ public void rewind(); |
+} |