Sitansu
Sitansu

Reputation: 3329

Type mismatch: cannot convert from List<SelectOption<Integer>> to List<SelectOption<String>>?

Here's code:

List<SelectOption<String>> validMemberList = ValidDataUtil.getValidMemberType();

Can anyone tell me :

How can convert the List<SelectOption<Integer>> to List<SelectOption<String>> ?

Upvotes: 1

Views: 403

Answers (2)

Abimaran Kugathasan
Abimaran Kugathasan

Reputation: 32478

How can convert the List<SelectOption<Integer>> to List<SelectOption<String>> ?

You can't, because both are two different data types. Iterate the list and convert each element with toString() method.

Upvotes: 1

T.J. Crowder
T.J. Crowder

Reputation: 1075059

How can convert the List<SelectOption<Integer>> to List<SelectOption<String>> ?

You can't, directly. You can loop through the first and use toString on each of the integers to build the second, though.

Upvotes: 3

Related Questions