문제

The List might contain both Integers and String values. In this case, should I create the List of Objects, right?

List<Object> list = new ArrayList<Object>();

How to perform simple arithmetic operations with the Integer entries of the List?

list.add(1);
list.add("ok");
list.add(2);
Integer a = list.get(0) - list.get(2); // does not work

올바른 솔루션이 없습니다

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top