componentType<C> abstract method
Retrieves the element or value type (C) of a collection-like
or container-like generic structure.
Supported Generic Types
- Lists:
List<T>→ returnsClass<T> - Sets:
Set<T>→ returnsClass<T> - Maps:
Map<K, V>→ returnsClass<V> - Queues, Streams, or any class with a single generic parameter.
Example
final listClass = Class.forType<List<double>>();
final componentType = listClass.asGenericSource().componentType<double>();
print(componentType.getName()); // 'double'
Implementation
Class<C>? componentType<C>();