I need to convert List of string to Array of userdefinedType and for array I need to convert string to long.
I have achieved the same using below approach to achieve it
TeamsNumberIdentifier[] securityPolicyIdArray = securityPolicyIds.stream()
.map(securityPolicy -> new TeamsNumberIdentifier(Long.valueOf(securityPolicy)))
.collect(Collectors.toCollection(ArrayList::new))
.toArray(new TeamsNumberIdentifier[securityPolicyIds.size()]);
Is there any better approach to convert this?