您的位置:首页 > Web前端

LinkedList 中add 和 offer 的区别?

2016-06-15 10:49 239 查看
add是list的
offer是queue的
api里说:
add:Inserts the specified element at the specified position in this list
将指定的元素插入到list中指定的的位置。
offer:Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions.
如果在不违反容量限制的情况下,尽可能快的将指定的元素插入到queue中去

通地这个就可以看出区别了,哪个没有任何限制,哪个有限制
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: