aboutsummaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorRblSb <msrblsb@gmail.com>2024-08-14 19:54:25 +0300
committerRblSb <msrblsb@gmail.com>2024-08-14 19:54:25 +0300
commit38cc0a1d9b4b146af7110c681389378fd26761fa (patch)
treee4a0a35e4a518508c4127fdb368f388ce130e2a0 /src/utils
parent097cf610e664c922c1c618b11a582bb6a1d959f8 (diff)
Seamless reconnection for first 5 seconds
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/ArrayKeyValueReverseIterator.hx19
-rw-r--r--src/utils/ArrayReverseIterator.hx19
2 files changed, 38 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--};
+ }
+}
diff --git a/src/utils/ArrayReverseIterator.hx b/src/utils/ArrayReverseIterator.hx
new file mode 100644
index 0000000..9976c6a
--- /dev/null
+++ b/src/utils/ArrayReverseIterator.hx
@@ -0,0 +1,19 @@
+package utils;
+
+class ArrayReverseIterator<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 arr[i--];
+ }
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage