惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
S
Security Affairs
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
雷峰网
雷峰网
Recent Announcements
Recent Announcements
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
博客园_首页
The Cloudflare Blog
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
S
SegmentFault 最新的问题
P
Proofpoint News Feed
Y
Y Combinator Blog
Jina AI
Jina AI
博客园 - 聂微东
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
F
Full Disclosure
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
T
Tailwind CSS Blog
J
Java Code Geeks
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 三生石上(FineUI控件)
W
WeLiveSecurity
PCI Perspectives
PCI Perspectives
Attack and Defense Labs
Attack and Defense Labs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
宝玉的分享
宝玉的分享
IT之家
IT之家
Hacker News: Ask HN
Hacker News: Ask HN
The Register - Security
The Register - Security
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs

6Jyc5p+a

【笔记】通过NapCat和AstrBot实现QQ机器人 【笔记】部署NapCat 【笔记】部署AstrBot 【笔记】Poetry学习笔记 【笔记】uv学习笔记 【笔记】Nodejs通过mysql2操作MySQL数据库 【笔记】CodeBuddy学习笔记 【笔记】MiMoCode学习笔记 【笔记】OpenCode使用XiaomMiMo作为供应商 【笔记】OpenCode学习笔记 【笔记】IDEA的AiAssistant使用自定义的Agent 【笔记】MacOS上删除TimeMachine时间机器备份 【笔记】MacOS上部署XiaomiMiloco 【笔记】Docker的上下文 【源码】Python3创建1x1像素的图片 【靶场】xss-labs通关攻略 【靶场】upload-labs通关攻略 【笔记】Brave迁移ProxySwitchyOmega数据到ZeroOmega 【笔记】通过Docker部署DVWA 【笔记】通过Docker部署xss-labs 【笔记】通过Docker部署upload-labs 【笔记】通过Docker部署Vulhub 【笔记】宝塔通过Docker部署SQLI-LABS 【笔记】宝塔部署Docker 【笔记】通过Docker部署SQLI-LABS 【靶场】SQLI-LABS通关攻略 【笔记】MSYS2学习笔记 【笔记】Cygwin学习笔记 【笔记】Windows添加自定义右键菜单项 【笔记】Linux上和MacOS上配置环境变量 【笔记】命令行配置HTTP代理 【笔记】Windows上配置环境变量 【踩坑】Windows上在IDEA中配置Codex报错 【笔记】start学习笔记 【笔记】Windows的CMD命令学习笔记 【笔记】IDEA通过AIAssistant安装Codex 【笔记】bcrypt学习笔记 【速查表】浏览器默认禁用的不安全端口 【笔记】Astro学习笔记 【代码】Python3实现从NTP服务器同步时间 【笔记】Koa学习笔记 【笔记】Solidity计算字符串的MD5值 【笔记】Hardhat学习笔记 【笔记】Go安装笔记 【笔记】CVE-2024-3094漏洞利用 【笔记】CVE-2026-43284和CVE-2026-43500漏洞利用 【笔记】CVE-2023-3567漏洞利用 【代码】Python3读写M1卡 【笔记】M1卡学习笔记 【笔记】Python3中文转拼音 【代码】Python3生成中国大陆姓名拼音 【代码】Python3爬取中国大陆手机号段 【笔记】Nodejs发送请求 【笔记】Trello通过API添加待办事项 【笔记】Nodejs的流和缓冲区 【笔记】Nodejs的事件 【笔记】Nodejs的文件和目录操作 【笔记】CNVD-2020-10487漏洞利用 【笔记】CVE-2017-12617漏洞利用 【笔记】PHP输出源码 【笔记】PHP的Phar 【笔记】通过Docker部署OnlineTools 【笔记】XML学习笔记 【笔记】Windows的用户和组 【笔记】CVE-2006-7243漏洞利用 【代码】JS将目录编号转换为十六进制 【笔记】PHP抑制所有报错 【笔记】HFish学习笔记 【笔记】JumpServer学习笔记 【笔记】Conpot学习笔记 【笔记】南墙WAF学习笔记 【笔记】堡塔云WAF学习笔记 【笔记】Windows的远程桌面服务 【笔记】Windows的防火墙
【笔记】Java的PriorityQueue和PriorityBlockingQueue
6Jyc5p+a · 2026-06-19 · via 6Jyc5p+a

前言

Java的PriorityQueue和PriorityBlockingQueue学习笔记

继承

graph TD
  Object --> AbstractCollection
  AbstractCollection --> AbstractQueue
  AbstractQueue --> PriorityBlockingQueue
  AbstractQueue --> PriorityQueue

  Iterable --> Collection
  Collection --> AbstractCollection

  Collection --> Queue
  Queue --> AbstractQueue

  style Object fill:#f0f8ff,stroke:#696969
  style AbstractCollection fill:#f0f8ff,stroke:#696969
  style AbstractQueue fill:#f0f8ff,stroke:#696969
  style PriorityBlockingQueue fill:#f0f8ff,stroke:#696969
  style PriorityQueue fill:#f0f8ff,stroke:#696969

  style Iterable fill:#f0f8ff,stroke:#4169e1
  style Collection fill:#f0f8ff,stroke:#4169e1

  style Queue fill:#f0f8ff,stroke:#4169e1
  • 底层维护排序顺序,遍历时不一定是按照排序顺序遍历,但是连续出队列时一定拿到的是有序的结果

创建对象

1
PriorityQueue<Object> queue = new PriorityQueue<>();

基于已有集合创建

1
2
3
Collection<Object> c;

PriorityQueue<Object> queue = new PriorityQueue<>(c);

PriorityBlockingQueue

  • PriorityBlockingQueue是线程安全的PriorityQueue

创建对象

1
PriorityBlockingQueue<Object> queue = new PriorityBlockingQueue<>();

基于已有集合创建

1
2
3
Collection<Object> c;

PriorityBlockingQueue<Object> queue = new PriorityBlockingQueue<>(c);

Collection的相关方法

传送门

Queue的相关方法

传送门

完成