Module java.base
Package java.util
package java.util
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描述Collection<E>The root interface in the collection hierarchy.集合层次结构中的根接口。Comparator<T>A comparison function, which imposes a total ordering on some collection of objects.一种比较函数,它对某些对象集合施加总排序。Deque<E>A linear collection that supports element insertion and removal at both ends.支持在两端插入和删除图元的线性集合。Enumeration<E>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.所有事件侦听器接口必须扩展的标记接口。Iterator<E>An iterator over a collection.集合上的迭代器。List<E>An ordered collection (also known as a sequence).有序集合(也称为序列)。ListIterator<E>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>NavigableSet<E>Deprecated.已弃用。PrimitiveIterator<T,T_CONS>A base type for primitive specializations ofIterator
.Iterator
的基元专门化的基类型。An Iterator specialized for专门用于double
values.double
值的迭代器。An Iterator specialized for专门用于int
values.int
值的迭代器。An Iterator specialized for专门用于long
values.long
值的迭代器。Queue<E>A collection designed for holding elements prior to processing.设计用于在处理前保存元素的集合。Marker interface used byList
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>SortedSet<E>Spliterator<T>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
接口的框架实现,以最小化实现此接口所需的工作量。AbstractList<E>AbstractMap<K,V>This class provides a skeletal implementation of the此类提供Map
interface, to minimize the effort required to implement this interface.Map
接口的框架实现,以最小化实现此接口所需的工作。AbstractMap.SimpleEntry<K,V>An Entry maintaining a key and a value.维护键和值的条目。An Entry maintaining an immutable key and value.维护不可变键和值的条目。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
接口的框架实现,以最小化实现由“顺序访问”数据存储(如链表)支持的此接口所需的工作量。AbstractSet<E>This class provides a skeletal implementation of the此类提供Set
interface to minimize the effort required to implement this interface.Set
接口的框架实现,以最小化实现此接口所需的工作量。ArrayDeque<E>ArrayList<E>Resizable-array implementation of theList
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.此类实现了一个根据需要增长的位向量。TheCalendar
class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such asYEAR
,MONTH
,DAY_OF_MONTH
,HOUR
, and so on, and for manipulating the calendar fields, such as getting the date of the next week.Calendar
类是一个抽象类,它提供了一些方法,用于在特定的时间瞬间和一组日历字段(如YEAR
、MONTH
、DAY_OF_MONTH
、HOUR
等)之间进行转换,并用于操作日历字段(如获取下周的日期)。Calendar.Builder
is used for creating aCalendar
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>TheDictionary
class is the abstract parent of any class, such asHashtable
, which maps keys to values.Dictionary
类是任何类(如Hashtable
)的抽象父类,它将键映射到值。A state object for collecting statistics such as count, min, max, sum, and average.用于收集统计信息(如计数、最小值、最大值、总和和平均值)的状态对象。EventListenerProxy<T extends EventListener>An abstract wrapper class for anEventListener
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 ofCalendar
and provides the standard calendar system used by most of the world.GregorianCalendar
是Calendar
的一个具体子类,提供了世界上大多数国家使用的标准日历系统。HashMap<K,V>Hash table based implementation of the基于Map
interface.Map
接口实现的哈希表。HashSet<E>This class implements the这个类实现Set
interface, backed by a hash table (actually aHashMap
instance).Set
接口,由一个哈希表(实际上是一个HashMap
实例)支持。Hashtable<K,V>This class implements a hash table, which maps keys to values.此类实现了一个哈希表,它将键映射到值。IdentityHashMap<K,V>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.用于收集统计信息(如计数、最小值、最大值、总和和平均值)的状态对象。LinkedHashMap<K,V>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.LinkedList<E>Doubly-linked list implementation of theList
andDeque
interfaces.List
和Deque
接口的双链表实现。ListResourceBundle
is an abstract subclass ofResourceBundle
that manages resources for a locale in a convenient and easy to use list.ListResourceBundle
是ResourceBundle
的一个抽象子类,它在一个方便易用的列表中管理区域设置的资源。ALocale
object represents a specific geographical, political, or cultural region.Locale
设置对象表示特定的地理、政治或文化区域。Builder
is used to build instances ofLocale
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
实用程序方法组成,用于对对象进行操作,或在操作前检查某些条件。Optional<T>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
值的容器对象。TheProperties
class represents a persistent set of properties.Properties
类表示一组持久的属性。This class is for property permissions.此类用于属性权限。PropertyResourceBundle
is a concrete subclass ofResourceBundle
that manages resources for a locale using a set of static strings from a property file.PropertyResourceBundle
是ResourceBundle
的一个具体子类,它使用属性文件中的一组静态字符串管理区域设置的资源。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 ofTimeZone
that represents a time zone for use with a Gregorian calendar.SimpleTimeZone
是TimeZone
的一个具体子类,表示用于公历的时区。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.OfInt、Spliterator.OfLong和Spliterator.OfDouble的实例。An abstract实现Spliterator.OfDouble
that implementstrySplit
to permit limited parallelism.trySplit
以允许有限并行的抽象Spliterator.OfDouble
。An abstract实现Spliterator.OfInt
that implementstrySplit
to permit limited parallelism.trySplit
以允许有限并行的抽象Spliterator.OfInt
。An abstract实现Spliterator.OfLong
that implementstrySplit
to permit limited parallelism.trySplit
以允许有限并行的抽象Spliterator.OfLong
。An abstract实现Spliterator
that implementstrySplit
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.一种均匀伪随机值生成器,适用于(除其他上下文外)可能生成子任务的独立并行计算。Stack<E>TheStack
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.线程调度任务以供将来在后台线程中执行的工具。TimeZone
represents a time zone offset, and also figures out daylight savings.TimeZone
表示时区偏移量,也表示夏令时。TreeMap<K,V>A Red-Black tree based NavigableMap implementation.基于红黑树的NavigableMap实现。TreeSet<E>A NavigableSet implementation based on a TreeMap.基于树映射的NavigableSet实现。A class that represents an immutable universally unique identifier (UUID).表示不可变的通用唯一标识符(UUID)的类。Vector<E>TheVector
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.由Locale和Locale.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.由各种访问器方法引发,以指示所请求的元素不存在。TheTooManyListenersException
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.查找、加载或实例化服务提供程序时出错时引发的错误。
This interface has been deprecated.此接口已被弃用。