Ds\Collection::isEmpty() 函数可以返回集合是否为空。
用法
abstract public bool Ds\Collection::isEmpty( void )
Ds\Collection::isEmpty() 函数没有任何参数。如果集合为空,则此函数可以返回 true,否则返回 false。
示例1
<?php
$collection = new \Ds\Vector([10, 15, 20, 25, 30, 35]);
$res = $collection->isEmpty();
var_dump($res);
$collection = new \Ds\Vector();
$res = $collection->isEmpty();
var_dump($res);
?>
示例2
<?php
$collection = new \Ds\Vector();
var_dump($collection->isEmpty());
$collection = new \Ds\Vector([1, 3, 5, 2, 6]);
var_dump($collection->isEmpty());
?>
相关用法
- PHP Ds\Collection::clear()用法及代码示例
- PHP Ds\Collection::copy()用法及代码示例
- PHP Ds\Collection::toArray()用法及代码示例
- PHP Ds\Collection copy()用法及代码示例
- PHP Ds\Collection clear()用法及代码示例
- PHP Ds\Collection isEmpty()用法及代码示例
- PHP Ds\Collection toArray()用法及代码示例
- PHP Ds\Queue::push()用法及代码示例
- PHP Ds\Sequence remove()用法及代码示例
- PHP Ds\Vector unshift()用法及代码示例
- PHP Ds\Vector last()用法及代码示例
- PHP Ds\Map putAll()用法及代码示例
- PHP Ds\PriorityQueue pop()用法及代码示例
- PHP Ds\Map slice()用法及代码示例
- PHP Ds\Vector merge()用法及代码示例
- PHP Ds\Set capacity()用法及代码示例
- PHP Ds\Queue pop()用法及代码示例
- PHP Ds\Set __construct()用法及代码示例
注:本文由纯净天空筛选整理自 PHP - Ds\Collection::isEmpty()。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。