Get the difference between this collection and another one.

@param \qtism\common\collections\AbstractCollection $collection
@return \qtism\common\collections\AbstractCollection
19552
public function diff(AbstractCollection $collection)
    {
        if (get_class($this) === get_class($collection)) {
            $newData = array_diff($this->dataPlaceHolder, $collection->getDataPlaceHolder());

            return new static($newData);
        } else {
            $msg = "Difference may apply only on two collections of the same type.";
            throw new InvalidArgumentException($msg);
        }
    }
207403
public function getTree(\Illuminate\Database\Eloquent\Collection $collection)
    {
        $collection = $collection->sortBy($this->repository->getOrderField());

        return $collection;
    }
1356193
public static function get_metadata(collection $collection) : collection {
        $data = [
            'assignment' => 'privacy:metadata:assignmentid',
            'grade' => 'privacy:metadata:gradepurpose',
            'commenttext' => 'privacy:metadata:commentpurpose'
        ];
        $collection->add_database_table('assignfeedback_comments', $data, 'privacy:metadata:tablesummary');
        $collection->link_subsystem('core_files', 'privacy:metadata:filepurpose');

        return $collection;
    }
38449
public function getObjectsByCollection(CollectionInterface $collection)
    {
        $objects = array();
        $that = $this;
        $bucketName = $this->bucketName;

        foreach ($this->resourceRepository->findByCollectionName($collection->getName()) as $resource) {
            /** @var \Neos\Flow\ResourceManagement\PersistentResource $resource */
            $object = new StorageObject();
            $object->setFilename($resource->getFilename());
            $object->setSha1($resource->getSha1());
            $object->setStream(function () use ($that, $bucketName, $resource) {
                return fopen('s3://' . $bucketName . '/' . $this->keyPrefix . $resource->getSha1(), 'r');
            });
            $objects[] = $object;
        }

        return $objects;
    }
15622
public function union($collection)
    {
        $union = clone $this;

        /** @var ModelInterface $otherModel */
        foreach ($collection->diff($this) as $otherModel) {
            $union->push($otherModel);
        }

        return $union;
    }
1052666
function giveCollection(MongoDB\Collection $collection)
    {
        if ($this->collection)
            throw new exImmutable;


        $this->collection = $collection;
        return $this;
    }
1111526
public function values($collection=null) {
    list($collection) = self::_wrapArgs(func_get_args(), 1);
    
    return self::_wrap(array_values((array) $collection));
  }
274901
public function compact($collection=null) {
    list($collection) = self::_wrapArgs(func_get_args(), 1);
    
    $collection = self::_collection($collection);
    
    $__ = new self;
    return self::_wrap($__->select($collection, function($val) {
      return (bool) $val;
    }));
  }
572712
public function collection(Collection $collection)
    {
        $entries = new Entries();

        foreach ($collection as $order) {
            $entry = new Entry($order);

            $entry
                ->field('id')
                ->field('firstname')
                ->field('lastname')
                ->field('address1')
                ->field('address2')
                ->field('zipcode')
                ->field('city')
                ->field('country')
                ->field('phone_work')
                ->field('phone_home')
                ->field('phone_mobile')
                ->field('other_informations')
            ;

            $entries->addEntry($entry);
        }

        return $entries->toArray();
    }
1360318
public LongHashSet difference(final LongHashSet collection) {
        checkNotNull(collection);

        LongHashSet difference = null;

        final LongIterator it = iterator();

        while (it.hasNext()) {
            final long value = it.nextValue();
            if (!collection.contains(value)) {
                if (difference == null) {
                    difference = new LongHashSet(size, missingValue);
                }

                difference.add(value);
            }
        }

        return difference;
    }
391046
protected function doResolve($alias, Collection $collection)
    {
        $result = null;
        switch (strtolower($alias)) {
            case self::LAST:
            case self::LATEST:
                $result = $collection->last();
                break;
            case self::FIRST:
            case self::EARLIEST:
                $result = $collection->first();
                break;
            default:
        }
        return $result;
    }
804567
public static function collectionToModel($collection) {
		if (is_string($collection)) {
			return \Factory::model($collection);
		} else if (!empty($collection['model'])) {
			return new \Object\Collection(['data' => $collection, 'skip_acl' => $collection['skip_acl'] ?? false]);
		} else {
			return null;
		}
	}
102572
public static function fromCollection($collection) {
		if (!(is_array($collection) || $collection instanceof Iterator)) {
			throw new InvalidArgumentException('$collection is neither an array nor an iterator');
		}

		return self::toCollection($collection);
	}
889162
public function hasCollection($collection)
    {
        if (empty($this->queriesResultCache[ 'collectionNames' ])) {
            $this->getCollections();
        }

        return (bool)in_array($collection, $this->queriesResultCache[ 'collectionNames' ]);
    }
1185325
public static function toMap($collection) {
		$map = new Map();
		foreach ($collection as $k => $v) {
			$map->set($k, self::toCollection($v));
		}

		return $map;
	}
841032
public function renumberCollection(Collection $collection)
    {
        $i = 0;

        foreach ( $collection as $item ) {
            if ( $item instanceof NumericallySortableContract ) {
                $item->updateSortingOrder(++$i);
            }
        }

        return $this;
    }
859767
public function get($collection = "")
	{
		if ($this->profiling)
		{
			$query = json_encode(array(
			'type'			=> 'find',
			'collection'	=> $collection,
			'select'		=> $this->selects,
			'where'			=> $this->wheres,
			'limit'			=> $this->limit,
			'offset'		=> $this->offset,
			'sort'			=> $this->sorts,
			));

			$benchmark = \Profiler::start((string) $this->db, $query);
		}

		$documents = $this->get_cursor($collection);

		if (isset($benchmark))
		{
			\Profiler::stop($benchmark);
		}

		$returns = array();

		if ($documents and ! empty($documents))
		{
			foreach ($documents as $doc)
			{
				$returns[] = $doc;
			}
		}

		return $returns;
	}