aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils/ArrayKeyValueReverseIterator.hx
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/ArrayKeyValueReverseIterator.hx')
-rw-r--r--src/utils/ArrayKeyValueReverseIterator.hx19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/utils/ArrayKeyValueReverseIterator.hx b/src/utils/ArrayKeyValueReverseIterator.hx
new file mode 100644
index 0000000..ad84e73
--- /dev/null
+++ b/src/utils/ArrayKeyValueReverseIterator.hx
@@ -0,0 +1,19 @@
+package utils;
+
+class ArrayKeyValueReverseIterator<T> {
+ final arr:Array<T>;
+ var i:Int;
+
+ public inline function new(arr:Array<T>) {
+ this.arr = arr;
+ this.i = this.arr.length - 1;
+ }
+
+ public inline function hasNext() {
+ return i > -1;
+ }
+
+ public inline function next() {
+ return {value: arr[i], key: i--};
+ }
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage