queue

queue

接口关系


继承关系

queue 和deque(双端队列)

  •  Each of these methods exists i n two forms: one throws an exception if the operation fails, the other returns a special value (either null or false, depending on the operation). The latter form of the insert operation is designed specifically for use with capacity-restricted Queue implementations; in most implementations, insert operations cannot fail.

     Throws exceptionReturns special value
    Insertadd(e)offer(e)
    Removeremove()poll()
    Examineelement()peek()

deque
First Element (Head)Last Element (Tail)
 Throws exceptionSpecial valueThrows exceptionSpecial value
InsertaddFirst(e)offerFirst(e)addLast(e)offerLast(e)
RemoveremoveFirst()pollFirst()removeLast()pollLast()
ExaminegetFirst()peekFirst()getLast()peekLast()

PriorityQueue

  • 本质实现是堆这种数据结构,每次都取出最大值或最小值(最大堆最小堆)
  • 使用优先级队列的主要是任务调度
  • 和Treeset一样,实现比较有两种,一种是comparable接口,一种是comparotor


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值