class Xs2aToSpiAccountReferenceMapper {

    public List<SpiAccountReference> mapToSpiAccountReferences(List<AccountReference> references) {
        if (CollectionUtils.isEmpty(references)) {
            return Collections.emptyList();
        }
        return references.stream()
                   .map(ref -> Optional.ofNullable(ref).map(this::mapToSpiAccountReference).orElse(null))
                   .filter(Objects::nonNull)
                   .collect(Collectors.toList());
    }

}