Top "Optional" questions

An immutable type that may contain a value or reference.

How to convert an Optional<T> into a Stream<T>?

I want to prepend a stream with an Optional. Since Stream.concat can only concatinate Streams I have this question: …

java java-8 java-stream optional
Which Swift types can be represented in Objective-C?

I'm creating an NSManagedObject subclass in Swift and I get an error when I make an Optional property that's of …

objective-c swift nsmanagedobject optional
Optional in Lombok

I have a class called Address which looks like this: @Value class Address { @NotNull String userId; @NotNull String line1; String …

java optional lombok
How to use swift flatMap to filter out optionals from an array

I'm a little confused around flatMap (added to Swift 1.2) Say I have an array of some optional type e.g. …

swift functional-programming optional higher-order-functions flatmap
Optional array vs. empty array in Swift

I have a simple Person class in Swift that looks about like this: class Person { var name = "John Doe" var …

arrays swift optional
How to convert Swift optional NSNumber to optional Int? (any improvements on my code?)

What would be the shortest/cleanest way to convert an Optional Number to an Optional Int in Swift? Is there …

ios swift swift2 optional nsnumber
Treating a forced downcast as optional will never produce 'nil'

I've been playing around with Swift and discovered that when down casting an object to be inserted into a dictionary, …

swift optional downcast forced-unwrapping
Optional Chaining Operator in Typescript

In javascript, Optional Chaining Operator is supported by the babel plugin. But I can't find how to do this in …

javascript typescript optional chaining
Why non optional Any can hold nil?

In Swift I can declare a constant of type Any and put a String into it. let any: Any = "hello …

swift optional
std::optional specialization for reference types

Why std::optional (std::experimental::optional in libc++ at the moment) does not have specialization for reference types (compared with …

c++ c++11 stl optional boost-optional