How to perform subtraction between two Arraylist items in java

半城伤御伤魂 提交于 2019-12-11 23:47:16

问题


I have two list which have data items of String type.The lists are

    List<String> all=new ArrayList<String>();
    List<String> al2=new ArrayList<String>();

The items are added in the lists from Resultset as:-

                 all.add((rs.getString(3)));
                 all.add((rs.getString(4)));
                 al2.add((rs.getString(3)));
                 al2.add((rs.getString(4)));

There are numerical values in the list,I want to subtract the data items from list according to the column retrieved from resultset i.e

Subtract(rs.getString(3) of all,rs.getString(3) of al2)

and display there results.How to achieve this subtraction in lists?

来源:https://stackoverflow.com/questions/28358778/how-to-perform-subtraction-between-two-arraylist-items-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!