S
S
sys_user2019-07-04 17:16:50
Java
sys_user, 2019-07-04 17:16:50

Is it possible to cast a BigInteger list to a String list?

Is it possible to cast list to list by ready-made means? not to write something like this

private List<String> converter(List<BigInteger> items) {
        List<String> result = new ArrayList<>();
        for (BigInteger item: items) {
            result.add(item.toString());
        }
        return result;
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2019-07-04
@sys_user

List<String> result = items.stream()
                           .map(Object::toString)
                           .collect(Collectors.toList());

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question