目录

简介

lowerXXX,floorXXX,ceilingXXX,higherXXX,总共8个

firstEntry,lastEntry,pollFirstEntry,pollLastEntry

descendingMap,navigableKeySet,descendingKeySet

subMap,tailMap,headMap,每个2个


简介

/*** 一个SortedMap扩展了navigation方法,为给定的搜索目标返回最接近的匹配。* 方法lowerEntry, floorEntry, ceilingEntry, 和 higherEntry返回* Map.Entry对象,分别与小于、小于或等于、大于或等于、大于给定键关联的条目对象,如果没有这样的键,则返回null。* 类似地,方法lowerKey、floorKey、ceilingKey和higherKey只返回关联的键。所有这些方法都是为定位而设计的,而不是遍历条目。** <p>可按升序或降序键顺序访问和遍历NavigableMap。* descendingMap方法返回映射的一个视图,该视图具有所有反向的关系和反转方向的方法。* ascending操作和视图的性能可能比descending操作和视图的性能更快。* 方法subMap、headMap和tailMap与类似名称的SortedMap方法不同,它们接受额外的参数来描述下界和上界是包含的还是排他的。* 任何NavigableMap的子映射都必须实现NavigableMap接口。** <p>该接口还定义了firstEntry、pollFirstEntry、lastEntry和pollLastEntry方法,* 这些方法返回和/或删除最小和最大的映射(如果存在的话),否则返回null。** <p>返回entry方法的实现应该返回Map.Entry对,表示生成映射时的快照,因此通常不支持可选的setValue方法。* 但是请注意,可以使用put方法更改关联映射中的映射。** <p>方法subMap(K, K)、headMap(K)和tailMap(K)被指定为返回SortedMap,* 以允许对SortedMap的现有实现进行兼容的改进以实现NavigableMap,但是这个接口的扩展和实现被鼓励重写这些方法以返回NavigableMap。* 类似地,可以覆盖keySet()来返回NavigableSet。*** @author Doug Lea* @author Josh Bloch* @param <K> the type of keys maintained by this map* @param <V> the type of mapped values* @since 1.6*/
public interface NavigableMap<K,V> extends SortedMap<K,V>

lowerXXX,floorXXX,ceilingXXX,higherXXX,总共8个

    /*** 返回严格小于给定键的与最大键关联的键-值映射,如果没有这样的键,则返回null。** @param key the key* @return an entry with the greatest key less than {@code key},*         or {@code null} if there is no such key* @throws ClassCastException if the specified key cannot be compared*         with the keys currently in the map* @throws NullPointerException if the specified key is null*         and this map does not permit null keys*/Map.Entry<K,V> lowerEntry(K key);/*** 返回严格小于给定键的最大键,如果没有这样的键,则返回null。** @param key the key* @return the greatest key less than {@code key},*         or {@code null} if there is no such key* @throws ClassCastException if the specified key cannot be compared*         with the keys currently in the map* @throws NullPointerException if the specified key is null*         and this map does not permit null keys*/K lowerKey(K key);/*** 返回与小于或等于给定键的最大键相关联的键-值映射,如果没有这样的键,则返回null。** @param key the key* @return an entry with the greatest key less than or equal to*         {@code key}, or {@code null} if there is no such key* @throws ClassCastException if the specified key cannot be compared*         with the keys currently in the map* @throws NullPointerException if the specified key is null*         and this map does not permit null keys*/Map.Entry<K,V> floorEntry(K key);/*** Returns the greatest key less than or equal to the given key,* or {@code null} if there is no such key.** @param key the key* @return the greatest key less than or equal to {@code key},*         or {@code null} if there is no such key* @throws ClassCastException if the specified key cannot be compared*         with the keys currently in the map* @throws NullPointerException if the specified key is null*         and this map does not permit null keys*/K floorKey(K key);/*** 返回与大于或等于给定键的最小键关联的键-值映射,如果没有这样的键,则返回null。** @param key the key* @return an entry with the least key greater than or equal to*         {@code key}, or {@code null} if there is no such key* @throws ClassCastException if the specified key cannot be compared*         with the keys currently in the map* @throws NullPointerException if the specified key is null*         and this map does not permit null keys*/Map.Entry<K,V> ceilingEntry(K key);/*** 返回大于或等于给定键的最小键,如果没有这样的键,则返回null。** @param key the key* @return the least key greater than or equal to {@code key},*         or {@code null} if there is no such key* @throws ClassCastException if the specified key cannot be compared*         with the keys currently in the map* @throws NullPointerException if the specified key is null*         and this map does not permit null keys*/K ceilingKey(K key);/*** 返回与严格大于给定键的最小键关联的键-值映射,如果没有这样的键,则返回null。** @param key the key* @return an entry with the least key greater than {@code key},*         or {@code null} if there is no such key* @throws ClassCastException if the specified key cannot be compared*         with the keys currently in the map* @throws NullPointerException if the specified key is null*         and this map does not permit null keys*/Map.Entry<K,V> higherEntry(K key);/*** 返回严格大于给定键的最小键,如果没有这样的键,则返回null。** @param key the key* @return the least key greater than {@code key},*         or {@code null} if there is no such key* @throws ClassCastException if the specified key cannot be compared*         with the keys currently in the map* @throws NullPointerException if the specified key is null*         and this map does not permit null keys*/K higherKey(K key);

firstEntry,lastEntry,pollFirstEntry,pollLastEntry

    /*** 返回与此映射中最小键关联的键-值映射,如果映射为空则返回null。** @return an entry with the least key,*         or {@code null} if this map is empty*/Map.Entry<K,V> firstEntry();/*** 返回与此映射中最大键关联的键-值映射,如果映射为空则返回null。** @return an entry with the greatest key,*         or {@code null} if this map is empty*/Map.Entry<K,V> lastEntry();/*** 删除并返回与此映射中最小键关联的键-值映射,如果映射为空则返回null。** @return the removed first entry of this map,*         or {@code null} if this map is empty*/Map.Entry<K,V> pollFirstEntry();/*** 删除并返回与此映射中最大键关联的键-值映射,如果映射为空则返回null。** @return the removed last entry of this map,*         or {@code null} if this map is empty*/Map.Entry<K,V> pollLastEntry();

descendingMap,navigableKeySet,descendingKeySet

    /*** 返回此映射中包含的映射的逆序视图。descending映射由该映射支持,因此对映射的更改反映在descending映射中,反之亦然。* 如果在对任何一个map的集合视图进行迭代时(除了通过迭代器自己的删除操作之外),其中一个map被修改,那么迭代的结果是未定义的。** <p>返回的映射的顺序相当于Collections.reverseOrder(comparator())。* 表达式{@code m.descendingMap().descendingMap()}返回一个m的视图,它本质上等价于m。** @return a reverse order view of this map*/NavigableMap<K,V> descendingMap();/*** 返回包含在此映射中的键的NavigableSet视图。* 集合的迭代器按升序返回键。集合由映射支持,因此对映射的更改将反映在集合中,反之亦然。* 如果在对集合进行迭代时修改了映射(除了通过迭代器自己的删除操作),则迭代的结果是未定义的。* 集合支持元素删除,它通过Iterator.remove, Set.remove, removeAll, retainAll, and clear 操作。* 它不支持add或addAll操作。** @return a navigable set view of the keys in this map*/NavigableSet<K> navigableKeySet();/*** 返回包含在此映射中的键的逆序NavigableSet视图。* 集合的迭代器按降序返回键。集合由映射支持,因此对映射的更改将反映在集合中,反之亦然。* 如果在对集合进行迭代时修改了映射(除了通过迭代器自己的删除操作),则迭代的结果是未定义的。* 集合支持元素删除,它通过Iterator.remove, Set.remove, removeAll, retainAll, and clear 操作。* 它不支持add或addAll操作。** @return a reverse order navigable set view of the keys in this map*/NavigableSet<K> descendingKeySet();

subMap,tailMap,headMap,每个2个

    /*** 返回该映射中键值范围从fromKey到toKey的部分的视图。* 如果fromKey和toKey相等,则返回的映射为空,除非fromInclusive和toInclusive都为true。* 返回的映射得到此映射的支持,因此返回映射中的更改将反映在此映射中,反之亦然。* 返回的映射支持此映射支持的所有可选映射操作。** <p>返回的映射将抛出一个IllegalArgumentException,* 用于试图将一个键插入到它的范围之外,或者构造一个其端点位于它的范围之外的子映射。** @param fromKey low endpoint of the keys in the returned map* @param fromInclusive {@code true} if the low endpoint*        is to be included in the returned view* @param toKey high endpoint of the keys in the returned map* @param toInclusive {@code true} if the high endpoint*        is to be included in the returned view* @return a view of the portion of this map whose keys range from*         {@code fromKey} to {@code toKey}* @throws ClassCastException if {@code fromKey} and {@code toKey}*         cannot be compared to one another using this map's comparator*         (or, if the map has no comparator, using natural ordering).*         Implementations may, but are not required to, throw this*         exception if {@code fromKey} or {@code toKey}*         cannot be compared to keys currently in the map.* @throws NullPointerException if {@code fromKey} or {@code toKey}*         is null and this map does not permit null keys* @throws IllegalArgumentException if {@code fromKey} is greater than*         {@code toKey}; or if this map itself has a restricted*         range, and {@code fromKey} or {@code toKey} lies*         outside the bounds of the range*/NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,K toKey,   boolean toInclusive);/*** 返回映射中键值小于(或等于,如果inclusive为true)toKey部分的视图。* 返回的映射得到此映射的支持,因此返回映射中的更改将反映在此映射中,反之亦然。* 返回的映射支持此映射支持的所有可选映射操作。** <p>返回的映射将抛出一个IllegalArgumentException,* 用于试图将一个键插入到它的范围之外,或者构造一个其端点位于它的范围之外的子映射。** @param toKey high endpoint of the keys in the returned map* @param inclusive {@code true} if the high endpoint*        is to be included in the returned view* @return a view of the portion of this map whose keys are less than*         (or equal to, if {@code inclusive} is true) {@code toKey}* @throws ClassCastException if {@code toKey} is not compatible*         with this map's comparator (or, if the map has no comparator,*         if {@code toKey} does not implement {@link Comparable}).*         Implementations may, but are not required to, throw this*         exception if {@code toKey} cannot be compared to keys*         currently in the map.* @throws NullPointerException if {@code toKey} is null*         and this map does not permit null keys* @throws IllegalArgumentException if this map itself has a*         restricted range, and {@code toKey} lies outside the*         bounds of the range*/NavigableMap<K,V> headMap(K toKey, boolean inclusive);/*** 返回映射中键值大于(或等于,如果inclusive为true)fromKey的部分的视图。* 返回的映射得到此映射的支持,因此返回映射中的更改将反映在此映射中,反之亦然。* 返回的映射支持此映射支持的所有可选映射操作。** <p>返回的映射将抛出一个IllegalArgumentException,* 用于试图将一个键插入到它的范围之外,或者构造一个其端点位于它的范围之外的子映射。** @param fromKey low endpoint of the keys in the returned map* @param inclusive {@code true} if the low endpoint*        is to be included in the returned view* @return a view of the portion of this map whose keys are greater than*         (or equal to, if {@code inclusive} is true) {@code fromKey}* @throws ClassCastException if {@code fromKey} is not compatible*         with this map's comparator (or, if the map has no comparator,*         if {@code fromKey} does not implement {@link Comparable}).*         Implementations may, but are not required to, throw this*         exception if {@code fromKey} cannot be compared to keys*         currently in the map.* @throws NullPointerException if {@code fromKey} is null*         and this map does not permit null keys* @throws IllegalArgumentException if this map itself has a*         restricted range, and {@code fromKey} lies outside the*         bounds of the range*/NavigableMap<K,V> tailMap(K fromKey, boolean inclusive);/*** {@inheritDoc}** <p>等于 {@code subMap(fromKey, true, toKey, false)}.** @throws ClassCastException       {@inheritDoc}* @throws NullPointerException     {@inheritDoc}* @throws IllegalArgumentException {@inheritDoc}*/SortedMap<K,V> subMap(K fromKey, K toKey);/*** {@inheritDoc}** <p>等于 {@code headMap(toKey, false)}.** @throws ClassCastException       {@inheritDoc}* @throws NullPointerException     {@inheritDoc}* @throws IllegalArgumentException {@inheritDoc}*/SortedMap<K,V> headMap(K toKey);/*** {@inheritDoc}** <p>等于 {@code tailMap(fromKey, true)}.** @throws ClassCastException       {@inheritDoc}* @throws NullPointerException     {@inheritDoc}* @throws IllegalArgumentException {@inheritDoc}*/SortedMap<K,V> tailMap(K fromKey);

java容器 接口NavigableMap源码分析相关推荐

  1. Java高并发程序设计学习笔记(五):JDK并发包(各种同步控制工具的使用、并发容器及典型源码分析(Hashmap等))...

    转自:https://blog.csdn.net/dataiyangu/article/details/86491786#2__696 1. 各种同步控制工具的使用 1.1. ReentrantLoc ...

  2. Java集合框架之接口Collection源码分析

    本文我们主要学习Java集合框架的根接口Collection,通过本文我们可以进一步了解Collection的属性及提供的方法.在介绍Collection接口之前我们不得不先学习一下Iterable, ...

  3. 死磕 java集合之ArrayDeque源码分析

    问题 (1)什么是双端队列? (2)ArrayDeque是怎么实现双端队列的? (3)ArrayDeque是线程安全的吗? (4)ArrayDeque是有界的吗? 简介 双端队列是一种特殊的队列,它的 ...

  4. 【死磕 Java 集合】— LinkedTransferQueue源码分析

    [死磕 Java 集合]- LinkedTransferQueue源码分析 问题 (1)LinkedTransferQueue是什么东东? (2)LinkedTransferQueue是怎么实现阻塞队 ...

  5. java arraydeque_死磕 java集合之ArrayDeque源码分析

    问题 (1)什么是双端队列? (2)ArrayDeque是怎么实现双端队列的? (3)ArrayDeque是线程安全的吗? (4)ArrayDeque是有界的吗? 简介 双端队列是一种特殊的队列,它的 ...

  6. idea 线程内存_Java线程池系列之-Java线程池底层源码分析系列(一)

    课程简介: 课程目标:通过本课程学习,深入理解Java线程池,提升自身技术能力与价值. 适用人群:具有Java多线程基础的人群,希望深入理解线程池底层原理的人群. 课程概述:多线程的异步执行方式,虽然 ...

  7. idea 线程内存_Java线程池系列之-Java线程池底层源码分析系列(二)

    课程简介: 课程目标:通过本课程学习,深入理解Java线程池,提升自身技术能力与价值. 适用人群:具有Java多线程基础的人群,希望深入理解线程池底层原理的人群. 课程概述:多线程的异步执行方式,虽然 ...

  8. 死磕Java集合之BitSet源码分析(JDK18)

    死磕Java集合之BitSet源码分析(JDK18) 文章目录 死磕Java集合之BitSet源码分析(JDK18) 简介 继承体系 存储结构 源码解析 属性 构造方法 set(int bitInde ...

  9. java中Mark接口_JVM源码分析之Java对象头实现

    原标题:JVM源码分析之Java对象头实现 原创申明:本文由公众号[猿灯塔]原创,转载请说明出处标注 "365篇原创计划"第十一篇. 今天呢!灯塔君跟大家讲: JVM源码分析之Ja ...

最新文章

  1. android-Activity
  2. maven升级遇到的疑惑
  3. html标签默认属性值之margin;padding值
  4. 关于Git和Github
  5. 实习日志_实习律师实习日志第十八篇(连载30篇)
  6. kakfa学习教程一
  7. OSI七层模型:TCP/IP HTTP WebSocket MQTT
  8. oracle查询日志空间大小,ORACLE 管理 日志与空间
  9. eclipse的优缺点
  10. 高端制造业企业信息化解决方案,工业电商平台设备、数据、体系预测性维护
  11. Java Web 后续(三)
  12. (c++)编写函数fac(n),用递归法求出n的阶乘.在程序中使用此函数,将输入的整数n的阶乘求出并输出到控制台.
  13. WebView加载String字符串
  14. HBuilder webApp开发(十)在线差异化升级
  15. li相关整理:如何改变li前面点的颜色和如何去掉li的点
  16. 数据分析 --- 收集数据的技巧
  17. 兄弟机cnc系统面板图解_加工中心操作面板各按键的意思
  18. vue style样式变量背景图
  19. 华为SMC2.0视频会议系统总结(一)
  20. Bluedroid: 蓝牙协议栈源码剖析

热门文章

  1. 第一章 - 新手入门 - 第二课 Arduino 简介
  2. php 去字符串空格函数,PHP 字符串去除空格函数trim
  3. unbuntu无法安装yum解决
  4. 三羊献瑞+祥瑞生辉(15年蓝桥杯)
  5. 生成对抗网络GAN 实现 手写体生成
  6. 手机更换电池-小米8se操作步骤
  7. Kinect v2 深度图与彩色图对齐(C++)
  8. pandas系列学习(六):数据聚合
  9. VC读取PE文件的OEP(程序入口)
  10. 脱壳:OEP(即程序入口点)查找 --- 基本思路和常见方法