其中addLastt和offerLast都是将指定元素插入到此列表的末尾,那就是说这两个在任何情况下两者可以互相替换? 作者: 小石头39910 时间: 2013-7-11 11:49
void addLast(E e) 将指定元素添加到此列表的结尾。 返回值是void 直接将元素插入
boolean offerLast(E e) 在此列表末尾插入指定的元素。 返回值是布尔类型的,用于判断,性质是不相同的,谈不上互换作者: changweihua 时间: 2013-7-11 11:56
Inserts the specified element at the front of this deque unless it would violate capacity restrictions. When using a capacity-restricted deque, this method is generally preferable to the addFirst(E) method, which can fail to insert an element only by throwing an exception.
在不违反容量限制的情况下,将指定的元素插入此双端队列的末尾。当使用有容量限制的双端队列时,此方法通常优于 addLast(E) 方法,后者可能无法插入元素,而只是抛出一个异常。作者: 崔一恒 时间: 2013-7-11 21:48
每天逛逛论坛