From fbe3e5073accb6c388a249abadbbb0b191b4437d Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Mon, 4 Jul 2022 02:26:47 +0700 Subject: [PATCH] Add LeaveOnlyNotNone() method in the parent class --- sources/Data/Collections/ArrayListIterator.uc | 3 ++- sources/Data/Collections/HashTableIterator.uc | 3 ++- sources/Data/Collections/Iter.uc | 7 +++++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/sources/Data/Collections/ArrayListIterator.uc b/sources/Data/Collections/ArrayListIterator.uc index 58452ff..7574bad 100644 --- a/sources/Data/Collections/ArrayListIterator.uc +++ b/sources/Data/Collections/ArrayListIterator.uc @@ -41,9 +41,10 @@ public function bool Initialize(Collection relevantArray) return true; } -public function LeaveOnlyNotNone() +public function Iter LeaveOnlyNotNone() { skipNoneReferences = true; + return self; } public function Iter Next(optional bool deprecated) diff --git a/sources/Data/Collections/HashTableIterator.uc b/sources/Data/Collections/HashTableIterator.uc index 2aba583..44ea74f 100644 --- a/sources/Data/Collections/HashTableIterator.uc +++ b/sources/Data/Collections/HashTableIterator.uc @@ -51,9 +51,10 @@ public function bool Initialize(Collection relevantArray) return true; } -public function LeaveOnlyNotNone() +public function Iter LeaveOnlyNotNone() { skipNoneReferences = true; + return self; } public function Iter Next(optional bool deprecated) diff --git a/sources/Data/Collections/Iter.uc b/sources/Data/Collections/Iter.uc index 7243eb4..d61286f 100644 --- a/sources/Data/Collections/Iter.uc +++ b/sources/Data/Collections/Iter.uc @@ -86,6 +86,13 @@ public function AcediaObject GetKey(); */ public function bool HasFinished(); +/** + * Makes caller iterator skip any `none` items during iteration. + * + * @return Reference to caller `Iterator` to allow for method chaining. + */ +public function Iter LeaveOnlyNotNone(); + defaultproperties { } \ No newline at end of file