Class OpenCollections.ListBuilder<T>
java.lang.Object
cloud.opencode.base.core.collect.OpenCollections.ListBuilder<T>
- Type Parameters:
T- the element type / 元素类型
- Enclosing class:
OpenCollections
A builder for creating unmodifiable lists incrementally.
用于增量创建不可修改列表的构建器。
- Since:
- JDK 25, opencode-base-core V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionAdds an element to this builder.Adds all elements from the iterable to this builder.build()Builds and returns an unmodifiable list containing all added elements.
-
Method Details
-
add
Adds an element to this builder. 向此构建器添加元素。- Parameters:
element- the element to add (must not be null) / 要添加的元素(不可为 null)- Returns:
- this builder / 此构建器
- Throws:
NullPointerException- if element is null / 如果 element 为 null
-
addAll
Adds all elements from the iterable to this builder. 将可迭代对象中的所有元素添加到此构建器。- Parameters:
iterable- the elements to add (must not be null, no null elements) / 要添加的元素(不可为 null,元素不可为 null)- Returns:
- this builder / 此构建器
- Throws:
NullPointerException- if iterable or any element is null / 如果 iterable 或任何元素为 null
-
build
-