<?php

namespace Lucent\Primitive;

use Illuminate\Support\Collection as LaravelCollection;

/**
 * @template T
 * @extends \Illuminate\Support\Collection<int, T>
 */
final class Collection extends LaravelCollection
{
    /**
     * @param array<T> $values
     */
    public function __construct(
        $values = []
    ) {
        parent::__construct($values);
    }

    /**
     * @return  array<T>
     **/
    public function toArray(): array
    {

        return collect($this)->values()->toArray();
    }

    /**
     * @return  Collection<T>
     **/
    public function rejectNull(): Collection
    {
        return $this->filter(fn($v) => !empty($v))->values();
    }


}
