public function take($length)
    {
        if(!is_int($length))
        {
            throw new \InvalidArgumentException();
        }

        if($length>=0 && $length>$this->length())
        {
            $length = $this->length();
        }
        elseif($length<0 && $length<(0-$this->length()))
        {
            $length = 0-$this->length();
        }

        $temp = $this->newInstance();

        if($length>=0)
        {
            $temp->setData(array_slice($this->getData(), 0, $length));
        }
        else
        {
            $temp->setData(array_slice($this->getData(), $length));
        }

        return $temp;
    }
public function take($length)
    {
        if(!is_int($length))
        {
            throw new \InvalidArgumentException();
        }

        if($length>=0 && $length>$this->length())
        {
            $length = $this->length();
        }
        elseif($length<0 && $length<(0-$this->length()))
        {
            $length = 0-$this->length();
        }

        $temp = $this->newInstance();

        if($length>=0)
        {
            $temp->setData(array_slice($this->getData(), 0, $length));
        }
        else
        {
            $temp->setData(array_slice($this->getData(), $length));
        }

        return $temp;
    }
public function take ( $ length ) { if ( ! is_int ( $ length ) ) { throw new \ InvalidArgumentException ( ) ; } if ( $ length >= 0 && $ length > $ this -> length ( ) ) { $ length = $ this -> length ( ) ; } elseif ( $ length < 0 && $ length < ( 0 - $ this -> length ( ) ) ) { $ length = 0 - $ this -> length ( ) ; } $ temp = $ this -> newInstance ( ) ; if ( $ length >= 0 ) { $ temp -> setData ( array_slice ( $ this -> getData ( ) , 0 , $ length ) ) ; } else { $ temp -> setData ( array_slice ( $ this -> getData ( ) , $ length ) ) ; } return $ temp ; }
Take first x fields
@param int $length
@return \PerrysLambda\ArrayList
Take first x fields