11package jdk .internal .access ;
22
3- import java .util .Collection ;
43import java .util .Objects ;
54import java .util .Set ;
65import java .util .function .Function ;
2019 * @param <T> The common type of the components. The type can be {@linkplain Object} if
2120 * there is no common super type for the components.
2221 */
23- public sealed interface StableComponentContainer <T > permits StableComponentContainerImpl {
22+ public sealed interface HeterogeneousContainer <T > permits HeterogeneousContainerImpl {
2423
2524 /**
2625 * {@return the associated component for the provided {@code type}}
2726 *
2827 * @param type to use as lookup
2928 * @param <C> component type
3029 * @throws IllegalArgumentException if the provided {@code type} was not specified
31- * {@linkplain StableComponentContainer #of(Set) at construction}.
30+ * {@linkplain HeterogeneousContainer #of(Set) at construction}.
3231 */
3332 <C extends T > C get (Class <C > type );
3433
@@ -41,7 +40,7 @@ public sealed interface StableComponentContainer<T> permits StableComponentConta
4140 * (nullable)
4241 * @param <C> component type
4342 * @throws IllegalArgumentException if the provided {@code type} was not specified
44- * {@linkplain StableComponentContainer #of(Set) at construction}.
43+ * {@linkplain HeterogeneousContainer #of(Set) at construction}.
4544 */
4645 <C extends T > C orElse (Class <C > type , C other );
4746
@@ -51,7 +50,7 @@ public sealed interface StableComponentContainer<T> permits StableComponentConta
5150 *
5251 * @param type to use as lookup
5352 * @throws IllegalArgumentException if the provided {@code type} was not specified
54- * {@linkplain StableComponentContainer #of(Set) at construction}.
53+ * {@linkplain HeterogeneousContainer #of(Set) at construction}.
5554 */
5655 boolean isInitialized (Class <? extends T > type );
5756
@@ -60,7 +59,7 @@ public sealed interface StableComponentContainer<T> permits StableComponentConta
6059 *
6160 * @param type to use as lookup
6261 * @throws IllegalArgumentException if the provided {@code type} was not specified
63- * {@linkplain StableComponentContainer #of(Set) at construction}.
62+ * {@linkplain HeterogeneousContainer #of(Set) at construction}.
6463 * @throws IllegalStateException if the provided {@code type} was already associated
6564 * with a component
6665 */
@@ -101,7 +100,7 @@ public sealed interface StableComponentContainer<T> permits StableComponentConta
101100 * @return the current (existing or computed) component associated with
102101 * the specified type
103102 * @throws IllegalArgumentException if the provided {@code type} was not specified
104- * {@linkplain StableComponentContainer #of(Set) at construction}.
103+ * {@linkplain HeterogeneousContainer #of(Set) at construction}.
105104 */
106105 <C extends T > C computeIfAbsent (Class <C > type ,
107106 Function <Class <C >, ? extends C > mappingFunction );
@@ -114,15 +113,15 @@ <C extends T> C computeIfAbsent(Class<C> type,
114113 * @param <T> the common type of the components. The type can be {@linkplain Object}
115114 * if there is no common super type for the components.
116115 */
117- static <T > StableComponentContainer <T > of (Set <Class <? extends T >> types ) {
116+ static <T > HeterogeneousContainer <T > of (Set <Class <? extends T >> types ) {
118117 // TOC TOU protection and
119118 // implicit null check of `types` and explicit null check on all its elements
120119 final Object [] inputs = new Object [types .size ()];
121120 int idx = 0 ;
122121 for (Object type : types ) {
123122 inputs [idx ++] = Objects .requireNonNull (type );
124123 }
125- return StableComponentContainerImpl .of (inputs );
124+ return HeterogeneousContainerImpl .of (inputs );
126125 }
127126
128127 /**
@@ -134,7 +133,7 @@ static <T> StableComponentContainer<T> of(Set<Class<? extends T>> types) {
134133 * @param <T> the common type of the components. The type can be {@linkplain Object}
135134 * if there is no common super type for the components.
136135 */
137- static <T > StableComponentContainer <T > of (Class <T > type ) {
136+ static <T > HeterogeneousContainer <T > of (Class <T > type ) {
138137 // Implicit null check
139138 if (!type .isSealed ()) {
140139 throw new IllegalArgumentException ("The provided type must be sealed: " + type );
0 commit comments