I have the following question: Having an Option of List of elements I want to transform it into a List of elements by avoiding the use of .get on the Option. Below is the snippet of code that I want to change : Any idea how to modify this please :
val receivedMessages = PubSubClient.getPulledMessages(client,subscriptionFullName,pullRequest).get
store(receivedMessages
.map(x => {
val sm = new PubsubSparkMessage
sm.message = x.getMessage
sm
})
.iterator)
I want to replace the .get in the line PubSubClient.getPulledMessages(client,subscriptionFullName,pullRequest).get