Module java.base

Package java.util


package java.util
Contains the collections framework, some internationalization support classes, a service loader, properties, random number generation, string parsing and scanning classes, base64 encoding and decoding, a bit array, and several miscellaneous utility classes. 包含集合框架、一些国际化支持类、服务加载器、属性、随机数生成、字符串解析和扫描类、base64编码和解码、位数组和几个杂项实用程序类。This package also contains legacy collection classes and legacy date and time classes. 此包还包含旧版集合类和旧版日期和时间类。

Java Collections FrameworkJava集合框架

For an overview, API outline, and design rationale, please see:有关概述、API大纲和设计原理,请参阅:

For a tutorial and programming guide with examples of use of the collections framework, please see:有关使用集合框架示例的教程和编程指南,请参阅:

Since:
1.0
  • Interface Summary接口摘要
    Interface接口
    Description描述
    The root interface in the collection hierarchy.集合层次结构中的根接口。
    A comparison function, which imposes a total ordering on some collection of objects.一种比较函数,它对某些对象集合施加总排序
    A linear collection that supports element insertion and removal at both ends.支持在两端插入和删除图元的线性集合。
    An object that implements the Enumeration interface generates a series of elements, one at a time.实现枚举接口的对象一次生成一系列元素。
    A tagging interface that all event listener interfaces must extend.所有事件侦听器接口必须扩展的标记接口。
    The Formattable interface must be implemented by any class that needs to perform custom formatting using the 's' conversion specifier of Formatter.Formattable接口必须由需要使用Formatter's'转换说明符执行自定义格式的任何类实现。
    An iterator over a collection.集合上的迭代器。
    List<E>
    An ordered collection (also known as a sequence).有序集合(也称为序列)。
    An iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator's current position in the list.列表的迭代器,允许程序员沿任意方向遍历列表,在迭代过程中修改列表,并获取迭代器在列表中的当前位置。
    Map<K,​V>
    An object that maps keys to values.将键映射到值的对象。
    Map.Entry<K,​V>
    A map entry (key-value pair).映射条目(键值对)。
    NavigableMap<K,​V>
    A SortedMap extended with navigation methods returning the closest matches for given search targets.通过导航方法扩展的SortedMap,返回给定搜索目标的最接近匹配项。
    A SortedSet extended with navigation methods reporting closest matches for given search targets.通过导航方法扩展的SortedSet,报告给定搜索目标的最接近匹配。
    Deprecated. 已弃用。
    This interface has been deprecated.此接口已被弃用。
    PrimitiveIterator<T,​T_CONS>
    A base type for primitive specializations of Iterator.Iterator的基元专门化的基类型。
    An Iterator specialized for double values.专门用于double值的迭代器。
    An Iterator specialized for int values.专门用于int值的迭代器。
    An Iterator specialized for long values.专门用于long值的迭代器。
    A collection designed for holding elements prior to processing.设计用于在处理前保存元素的集合。
    Marker interface used by List implementations to indicate that they support fast (generally constant time) random access.List实现使用的标记接口,用于指示它们支持快速(通常为常数时间)随机访问。
    Represents a service provider located by ServiceLoader.表示ServiceLoader定位的服务提供程序。
    Set<E>
    A collection that contains no duplicate elements.不包含重复元素的集合。
    SortedMap<K,​V>
    A Map that further provides a total ordering on its keys.进一步提供其键的总顺序的Map
    A Set that further provides a total ordering on its elements.进一步对其元素提供总排序Set
    An object for traversing and partitioning elements of a source.用于遍历和划分源元素的对象。
    A Spliterator specialized for double values.专用于double值的拆分器。
    A Spliterator specialized for int values.专门用于int值的拆分器。
    A Spliterator specialized for long values.专门用于long值的拆分器。
    Spliterator.OfPrimitive<T,​T_CONS,​T_SPLITR extends Spliterator.OfPrimitive<T,​T_CONS,​T_SPLITR>>
    A Spliterator specialized for primitive values.专门用于基本值的拆分器。
  • Class Summary类摘要
    Class
    Description描述
    This class provides a skeletal implementation of the Collection interface, to minimize the effort required to implement this interface.此类提供Collection接口的框架实现,以最小化实现此接口所需的工作量。
    This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a "random access" data store (such as an array).此类提供了List接口的框架实现,以最小化实现由“随机访问”数据存储(如数组)支持的接口所需的工作量。
    AbstractMap<K,​V>
    This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface.此类提供Map接口的框架实现,以最小化实现此接口所需的工作。
    An Entry maintaining a key and a value.维护键和值的条目。
    An Entry maintaining an immutable key and value.维护不可变键和值的条目。
    This class provides skeletal implementations of some Queue operations.此类提供一些Queue操作的框架实现。
    This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a "sequential access" data store (such as a linked list).此类提供了List接口的框架实现,以最小化实现由“顺序访问”数据存储(如链表)支持的此接口所需的工作量。
    This class provides a skeletal implementation of the Set interface to minimize the effort required to implement this interface.此类提供Set接口的框架实现,以最小化实现此接口所需的工作量。
    Resizable-array implementation of the Deque interface.Deque接口的可调整大小的数组实现。
    Resizable-array implementation of the List interface.List接口的可调整大小的数组实现。
    This class contains various methods for manipulating arrays (such as sorting and searching).此类包含用于操作数组(例如排序和搜索)的各种方法。
    This class consists exclusively of static methods for obtaining encoders and decoders for the Base64 encoding scheme.此类仅包含用于获取Base64编码方案的编码器和解码器的静态方法。
    This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.此类实现了一个解码器,用于使用RFC 4648和RFC 2045中指定的Base64编码方案对字节数据进行解码。
    This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.此类实现了一个编码器,用于使用RFC 4648和RFC 2045中指定的Base64编码方案对字节数据进行编码。
    This class implements a vector of bits that grows as needed.此类实现了一个根据需要增长的位向量。
    The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the calendar fields, such as getting the date of the next week.Calendar类是一个抽象类,它提供了一些方法,用于在特定的时间瞬间和一组日历字段(如YEARMONTHDAY_OF_MONTHHOUR等)之间进行转换,并用于操作日历字段(如获取下周的日期)。
    Calendar.Builder is used for creating a Calendar from various date-time parameters.Calendar.Builder用于根据各种日期时间参数创建Calendar
    This class consists exclusively of static methods that operate on or return collections.此类仅由对集合进行操作或返回集合的静态方法组成。
    Represents a currency.表示一种货币。
    The class Date represents a specific instant in time, with millisecond precision.Date表示特定的时间瞬间,精度为毫秒。
    Dictionary<K,​V>
    The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to values.Dictionary类是任何类(如Hashtable)的抽象父类,它将键映射到值。
    A state object for collecting statistics such as count, min, max, sum, and average.用于收集统计信息(如计数、最小值、最大值、总和和平均值)的状态对象。
    EnumMap<K extends Enum<K>,​V>
    A specialized Map implementation for use with enum type keys.用于枚举类型键的专用Map实现。
    EnumSet<E extends Enum<E>>
    A specialized Set implementation for use with enum types.用于枚举类型的专用Set实现。
    An abstract wrapper class for an EventListener class which associates a set of additional parameters with the listener.EventListener类的抽象包装类,它将一组附加参数与侦听器关联。
    The root class from which all event state objects shall be derived.派生所有事件状态对象的根类。
    FormattableFlags are passed to the Formattable.formatTo() method and modify the output format for Formattables.FormattableFlags被传递到Formattable.formatTo()方法并修改Formattables的输出格式。
    An interpreter for printf-style format strings.用于printf样式格式字符串的解释器。
    GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar system used by most of the world.GregorianCalendarCalendar的一个具体子类,提供了世界上大多数国家使用的标准日历系统。
    HashMap<K,​V>
    Hash table based implementation of the Map interface.基于Map接口实现的哈希表。
    This class implements the Set interface, backed by a hash table (actually a HashMap instance).这个类实现Set接口,由一个哈希表(实际上是一个HashMap实例)支持。
    Hashtable<K,​V>
    This class implements a hash table, which maps keys to values.此类实现了一个哈希表,它将键映射到值。
    This class implements the Map interface with a hash table, using reference-equality in place of object-equality when comparing keys (and values).此类使用哈希表实现Map接口,在比较键(和值)时使用引用相等代替对象相等。
    A state object for collecting statistics such as count, min, max, sum, and average.用于收集统计信息(如计数、最小值、最大值、总和和平均值)的状态对象。
    Hash table and linked list implementation of the Map interface, with predictable iteration order.哈希表和链表实现的Map接口,具有可预测的迭代顺序。
    Hash table and linked list implementation of the Set interface, with predictable iteration order.哈希表和链表的集合接口实现,具有可预测的迭代顺序。
    Doubly-linked list implementation of the List and Deque interfaces.ListDeque接口的双链表实现。
    ListResourceBundle is an abstract subclass of ResourceBundle that manages resources for a locale in a convenient and easy to use list.ListResourceBundleResourceBundle的一个抽象子类,它在一个方便易用的列表中管理区域设置的资源。
    A Locale object represents a specific geographical, political, or cultural region.Locale设置对象表示特定的地理、政治或文化区域。
    Builder is used to build instances of Locale from values configured by the setters.Builder用于根据setter配置的值构建Locale设置实例。
    This class expresses a Language Range defined in RFC 4647 Matching of Language Tags.此类表示RFC4647语言标记匹配中定义的语言范围
    A state object for collecting statistics such as count, min, max, sum, and average.用于收集统计信息(如计数、最小值、最大值、总和和平均值)的状态对象。
    This class consists of static utility methods for operating on objects, or checking certain conditions before operation.此类由static实用程序方法组成,用于对对象进行操作,或在操作前检查某些条件。
    Deprecated. 已弃用。
    This class and the Observer interface have been deprecated.此类和Observer接口已被弃用。
    A container object which may or may not contain a non-null value.可以包含或不包含非null值的容器对象。
    A container object which may or may not contain a double value.可能包含或不包含double值的容器对象。
    A container object which may or may not contain an int value.可以包含或不包含int值的容器对象。
    A container object which may or may not contain a long value.可能包含或不包含long值的容器对象。
    An unbounded priority queue based on a priority heap.基于优先级堆的无限优先级queue
    The Properties class represents a persistent set of properties.Properties类表示一组持久的属性。
    This class is for property permissions.此类用于属性权限。
    PropertyResourceBundle is a concrete subclass of ResourceBundle that manages resources for a locale using a set of static strings from a property file.PropertyResourceBundleResourceBundle的一个具体子类,它使用属性文件中的一组静态字符串管理区域设置的资源。
    An instance of this class is used to generate a stream of pseudorandom numbers.此类的实例用于生成伪随机数流。
    Resource bundles contain locale-specific objects.资源束包含特定于区域设置的对象。
    ResourceBundle.Control defines a set of callback methods that are invoked by the ResourceBundle.getBundle factory methods during the bundle loading process.ResourceBundle.Control定义了一组回调方法,这些方法在包加载过程中由ResourceBundle.getBundle工厂方法调用。
    A simple text scanner which can parse primitive types and strings using regular expressions.一个简单的文本扫描器,可以使用正则表达式解析原语类型和字符串。
    A facility to load implementations of a service.加载服务实现的工具。
    SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar.SimpleTimeZoneTimeZone的一个具体子类,表示用于公历的时区。
    Static classes and methods for operating on or creating instances of Spliterator and its primitive specializations Spliterator.OfInt, Spliterator.OfLong, and Spliterator.OfDouble.静态类和方法,用于操作或创建Spliterator及其基本特化Spliterator.OfIntSpliterator.OfLongSpliterator.OfDouble的实例。
    An abstract Spliterator.OfDouble that implements trySplit to permit limited parallelism.实现trySplit以允许有限并行的抽象Spliterator.OfDouble
    An abstract Spliterator.OfInt that implements trySplit to permit limited parallelism.实现trySplit以允许有限并行的抽象Spliterator.OfInt
    An abstract Spliterator.OfLong that implements trySplit to permit limited parallelism.实现trySplit以允许有限并行的抽象Spliterator.OfLong
    An abstract Spliterator that implements trySplit to permit limited parallelism.实现trySplit以允许有限并行的抽象Spliterator
    A generator of uniform pseudorandom values applicable for use in (among other contexts) isolated parallel computations that may generate subtasks.一种均匀伪随机值生成器,适用于(除其他上下文外)可能生成子任务的独立并行计算。
    The Stack class represents a last-in-first-out (LIFO) stack of objects.Stack类表示后进先出(LIFO)对象堆栈。
    StringJoiner is used to construct a sequence of characters separated by a delimiter and optionally starting with a supplied prefix and ending with a supplied suffix.StringJoiner用于构造由分隔符分隔的字符序列,可以选择以提供的前缀开头,以提供的后缀结尾。
    The string tokenizer class allows an application to break a string into tokens.字符串标记器类允许应用程序将字符串拆分为标记。
    A facility for threads to schedule tasks for future execution in a background thread.线程调度任务以供将来在后台线程中执行的工具。
    A task that can be scheduled for one-time or repeated execution by a Timer.一种任务,可由Timer安排为一次性或重复执行。
    TimeZone represents a time zone offset, and also figures out daylight savings.TimeZone表示时区偏移量,也表示夏令时。
    TreeMap<K,​V>
    A Red-Black tree based NavigableMap implementation.基于红黑树的NavigableMap实现。
    A NavigableSet implementation based on a TreeMap.基于树映射的NavigableSet实现。
    A class that represents an immutable universally unique identifier (UUID).表示不可变的通用唯一标识符(UUID)的类。
    The Vector class implements a growable array of objects.Vector类实现了一个可扩展的对象数组。
    WeakHashMap<K,​V>
    Hash table based implementation of the Map interface, with weak keys.基于哈希表实现的Map接口,带有弱键
  • Enum Class Summary枚举类摘要
    Enum Class枚举类
    Description描述
    Enum for BigDecimal formatting.用于BigDecimal格式的枚举。
    Enum for locale categories.区域设置类别的枚举。
    This enum provides constants to select a filtering mode for locale matching.此枚举提供常量以选择区域设置匹配的筛选模式。
    Enum for specifying the type defined in ISO 3166.用于指定ISO 3166中定义的类型的枚举。
  • Exception Summary异常摘要
    Exception异常
    Description描述
    This exception may be thrown by methods that have detected concurrent modification of an object when such modification is not permissible.当对象的并发修改不允许时,检测到该修改的方法可能会引发此异常。
    Unchecked exception thrown when duplicate flags are provided in the format specifier.在格式说明符中提供重复标志时引发未经检查的异常。
    Thrown by methods in the Stack class to indicate that the stack is empty.Stack类中的方法引发,以指示堆栈为空。
    Unchecked exception thrown when a conversion and flag are incompatible.转换和标志不兼容时引发未经检查的异常。
    Unchecked exception thrown when the formatter has been closed.格式化程序关闭时引发未经检查的异常。
    Unchecked exception thrown when a character with an invalid Unicode code point as defined by Character.isValidCodePoint(int) is passed to the Formatter.Character.isValidCodePoint(int)定义的具有无效Unicode代码点的字符传递给Formatter时引发未经检查的异常。
    Unchecked exception thrown when the argument corresponding to the format specifier is of an incompatible type.当与格式说明符对应的参数的类型不兼容时,引发未经检查的异常。
    Unchecked exception thrown when a format string contains an illegal syntax or a format specifier that is incompatible with the given arguments.当格式字符串包含非法语法或与给定参数不兼容的格式说明符时引发未经检查的异常。
    Unchecked exception thrown when an illegal combination flags is given.给出非法组合标志时引发未经检查的异常。
    Unchecked exception thrown when the precision is a negative value other than -1, the conversion does not support a precision, or the value is otherwise unsupported.当精度为-1以外的负值、转换不支持精度或该值不受支持时,引发未选中异常。
    Unchecked exception thrown when the format width is a negative value other than -1 or is otherwise unsupported.当格式宽度为-1以外的负值或不受支持时,引发未经检查的异常。
    Thrown by methods in Locale and Locale.Builder to indicate that an argument is not a well-formed BCP 47 tag.LocaleLocale.Builder中的方法引发,以指示参数不是格式良好的BCP 47标记。
    Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.Scanner引发,以指示检索到的令牌与预期类型的模式不匹配,或者该令牌超出预期类型的范围。
    Thrown to indicate that an operation could not complete because the input did not conform to the appropriate XML document type for a collection of properties, as per the Properties specification.抛出以指示操作无法完成,因为根据Properties规范,输入不符合属性集合的适当XML文档类型。
    Unchecked exception thrown when there is a format specifier which does not have a corresponding argument or if an argument index refers to an argument that does not exist.当格式说明符没有相应的参数或参数索引引用不存在的参数时,引发未经检查的异常。
    Unchecked exception thrown when the format width is required.需要格式宽度时引发未选中的异常。
    Signals that a resource is missing.表示资源丢失。
    Thrown by various accessor methods to indicate that the element being requested does not exist.由各种访问器方法引发,以指示所请求的元素不存在。
    The TooManyListenersException Exception is used as part of the Java Event model to annotate and implement a unicast special case of a multicast Event Source.ToomanyListenerException异常用作Java事件模型的一部分,用于注释和实现多播事件源的单播特例。
    Unchecked exception thrown when an unknown conversion is given.给定未知转换时引发未经检查的异常。
    Unchecked exception thrown when an unknown flag is given.给定未知标志时引发未经检查的异常。
  • Error Summary错误摘要
    Error错误
    Description描述
    Error thrown when something goes wrong while locating, loading, or instantiating a service provider.查找、加载或实例化服务提供程序时出错时引发的错误。