Short description of method union

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@param  Collection collection
@return core_kernel_classes_ContainerCollection
484075
public function union( common_Collection $collection)
    {
        $returnValue = null;

        
        $returnValue = new core_kernel_classes_ContainerCollection($this);     
        $returnValue->sequence = array_merge($this->sequence, $collection->sequence );      
        

        return $returnValue;
    }
358411
public function createCollection(Collection $collection): Collection
    {
        $query = $this->connection->createQueryBuilder()
            ->insert('ngbm_collection')
            ->values(
                [
                    'id' => ':id',
                    'status' => ':status',
                    'start' => ':start',
                    'length' => ':length',
                    'translatable' => ':translatable',
                    'main_locale' => ':main_locale',
                    'always_available' => ':always_available',
                ]
            )
            ->setValue(
                'id',
                $collection->id !== null ?
                    (int) $collection->id :
                    $this->connectionHelper->getAutoIncrementValue('ngbm_collection')
            )
            ->setParameter('status', $collection->status, Type::INTEGER)
            ->setParameter('start', $collection->offset, Type::INTEGER)
            ->setParameter('length', $collection->limit, Type::INTEGER)
            ->setParameter('translatable', $collection->isTranslatable, Type::BOOLEAN)
            ->setParameter('main_locale', $collection->mainLocale, Type::STRING)
            ->setParameter('always_available', $collection->alwaysAvailable, Type::BOOLEAN);

        $query->execute();

        $collection->id = $collection->id ?? (int) $this->connectionHelper->lastInsertId('ngbm_collection');

        return $collection;
    }
353282
public function merge($collection, $preserveKeys = false)
    {
        foreach($collection as $key => $value) {
            $preserveKeys ? $this[$key] = $value : $this[] = $value;
        }
        return $this;
    }
1035194
public function createFromCollection(Collection $collection)
    {
        $this->operator = new CollectionOperator($collection, $this->request);
        $this->prepare();

        return $this;
    }
1094977
public static <T> Set<T> toSet(final Collection<T> collection) {

        if (isEmpty(collection)) {
            return new HashSet<T>(0);
        } else {
            return new HashSet<T>(collection);
        }
    }
363099
public function collections()
    {
        if (!$this->collections) {
            $this->collections = [];

            /** @var \record_adapter $record */
            foreach ($this as $record) {
                if (! isset($this->collections[$record->getBaseId()])) {
                    $this->collections[$record->getBaseId()] = $record->get_collection();
                }
            }

            $this->collections = array_values($this->collections);
        }

        return $this->collections;
    }
385736
public function addManagedCollections($collections)
    {
        if (!is_array($collections)) {
            $collections = array($collections);
        }
        $this->managedCollections = array_merge($this->managedCollections, $collections);

        return $this;
    }
692364
public function getEqualFromCollection(\Phunc\Collection $collection)
    {
        $new_collection = clone $this;
        $new_collection->cleanCollection();

        /** @var CollectionInstanceInterface $instance */
        foreach ($this->getCollection() as $instance) {
            /** @var CollectionInstanceInterface $same */
            foreach ($collection as $same) {
                if ($this->isEqual($same)) {
                    $new_collection->add($this->getEqual($same));
                }
            }
        }
        return $new_collection;
    }
289629
public function setCollection($collection)
    {
        $this->indexedContainer = $collection;

        foreach ($collection as $argModel) {
            $this->hashedContainer[$argModel->getName()] = $argModel;
        }

        return $this;
    }
1174353
public function merge($items): CollectionInterface
    {
        return $this->wrap(function (Iterator $data) use ($items) {
            yield from $data;

            if (is_iterable($items)) {
                yield from $items;
            } elseif ($items) {
                yield $items;
            }
        });
    }
1128330
@SuppressWarnings("unchecked")
    public static <T> T[] toArray(Collection<T> collection, Class<T> clazz) {
        if (collection == null) {
            return null;
        }
        return collection.toArray((T[]) Array.newInstance(clazz, collection.size()));
    }
76873
public static <T> Source<T> join(Collection<Source<T>> collection) {
        return join(collection.iterator());
    }
516828
public function getCollections()
    {
        if ($this->collections) {
            return $this->collections;
        }

        $collectionMapper = ($this->container->dataMapper)('CollectionMapper');

        return $this->collections = $collectionMapper->find();
    }
568026
public function mergeCollection(self $collection)
    {
        foreach ($collection->getSuites() as $suite) {
            $this->addSuite($suite);
        }
    }
1282259
public function merge(ArrayCollection $collection)
    {
        if (!$collection instanceof GeometryCollection || $collection->getGeometryType() !== $this->getGeometryType()) {
            throw new InvalidArgumentException("Collections types don't match, you can't merge.");
        }

        return parent::merge($collection);
    }
1129773
public static <E> Collection<E> unionColl(Collection<E> c1, Collection<E> c2) {
	return new UColl<E>(c1, c2);
    }
17047
public function setCollection($collection)
    {
        $this->collection = $collection;

        $this->collection->setCurPage($this->getCurrentPage());

        // we need to set pagination only if passed value integer and more that 0
        $limit = (int)$this->getLimit();
        if ($limit) {
            $this->collection->setPageSize($limit);
        }
        if ($this->getCurrentOrder()) {
            $this->collection->setOrder($this->getCurrentOrder(), $this->getCurrentDirection());
        }

        return $this;
    }