Question

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

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top