首页 > 编程知识 正文

as的用法总结及典型句子,动词不定式的用法总结

时间:2023-05-05 05:17:26 阅读:249389 作者:2781

队列,一种结构体,遵循先进先出的原则。

java中提供的方法有以下几种:


操作有插入、删除和检查某个下标是否有值三种,其中每种操作包含两个函数,它们的功能是相同的,区别在于insert,remove,element三个函数在操作失败是报异常,而offer,poll,peek三个函数不报异常。

具体描述原句是这样的:

  Each of these methods exists in two forms: one throws an exception if the operation fails, the other returns a special value (either null or false, depending on the operation). 

但是这种说法并不绝对,poll和peek确实不报异常,但是offer函数在某些情况下会报异常,具体如下:

ClassCastException - if the class of the specified element prevents it from being added to this queueNullPointerException - if the specified element is null and this queue does not permit null elements

IllegalArgumentException - if some property of this element prevents it from being added to this queue


但是插入发生异常的情况可能性比较小。

在以后的使用中,要根据应用场景选择合适的函数。


版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。