new X(); --> typeArguments == Optional is empty
new X<>(); --> typeArguments = [], diamondOperator = true
new X<C,D>(); --> typeArguments = [C,D], diamondOperator = false
Only ObjectCreationExpr uses the diamond operator.
On other nodes it is treated the same as the first case.
| Modifier and Type | Method and Description |
|---|---|
| public Optional | |
| public default boolean | |
| public default N | |
| public default N | |
| public N | setTypeArguments(NodeList<Type>
The list of types of the generics, can be null typeArguments)Allows you to set the generic arguments |
| public default N |
| getTypeArguments | back to summary |
|---|---|
| public Optional | |
| isUsingDiamondOperator | back to summary |
|---|---|
public default boolean isUsingDiamondOperator()
| |
| removeTypeArguments | back to summary |
|---|---|
| public default N removeTypeArguments() Removes all type arguments, including the surrounding <>.
| |
| setDiamondOperator | back to summary |
|---|---|
| public default N setDiamondOperator() Sets the type arguments to <>.
| |
| setTypeArguments | back to summary |
|---|---|
| public N setTypeArguments(NodeList<Type> typeArguments) Allows you to set the generic arguments | |
| setTypeArguments | back to summary |
|---|---|
public default N setTypeArguments(Type... typeArguments)
| |