Browse Source

Change `ArrayListIterator` to use filter method

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
2ca4e3aa61
  1. 12
      sources/Data/Collections/ArrayListIterator.uc

12
sources/Data/Collections/ArrayListIterator.uc

@ -22,9 +22,12 @@ class ArrayListIterator extends Iter;
var private ArrayList relevantCollection; var private ArrayList relevantCollection;
var private int currentIndex; var private int currentIndex;
var private bool skipNoneReferences;
protected function Finalizer() protected function Finalizer()
{ {
relevantCollection = none; relevantCollection = none;
skipNoneReferences = false;
} }
public function bool Initialize(Collection relevantArray) public function bool Initialize(Collection relevantArray)
@ -37,10 +40,15 @@ public function bool Initialize(Collection relevantArray)
return true; return true;
} }
public function Iter Next(optional bool skipNone) public function LeaveOnlyNotNone()
{
skipNoneReferences = true;
}
public function Iter Next()
{ {
local int collectionLength; local int collectionLength;
if (!skipNone) if (!skipNoneReferences)
{ {
currentIndex += 1; currentIndex += 1;
return self; return self;

Loading…
Cancel
Save