java optional to collection
public static <T> List<T> toList(Optional<T> opt) {
return opt
.map(Collections::singletonList)
.orElseGet(Collections::emptyList);
}
Also in Java:
- how make a final variable in java
- array string java in one line
- detect tv remote keys andoid studio
- java identifiers
- java ternary operator
- treeset java descending order using comparator
- j
- java throws multiple exceptions
- isSelfDivisor java
- for loop in java stack overflow
- Java sort Map by values
- how to check if rs next is null
- what is java plug-in
- reverse string using recursion java with explanation
- java how to get current date
- generate all prime number less than n java
- check if a char is a space java
- java output array lists to file
- how to minimize jframe in java
- how to append to a string in java
- list in java
- java unit test an api
- check last character of string java
- how to install java runtime environment on centos 7