package com.orionplatform.data.data_structures.tasks;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import com.orionplatform.core.abstraction.Orion;

public class GetIteratorAsSetTask extends Orion
{
    public static synchronized <T> Set<T> run(Iterator<T> iterator)
    {
        Set<T> set = new HashSet<>();
        
        if(iterator != null)
        {
            iterator.forEachRemaining(e -> set.add(e));
        }
        
        return set;
    }
}