-2
if (rs != null) {

    while (rs.next()) {
        rb = new ResponseBean();

        rb.setQuestionOrderNo(rs.getInt(1));

        rb.setResponseLabel(rs.getString(2));

        rb.setTaskName(rs.getString(3));

        rb.setResponder(rs.getString(4));

        rb.setSequenceId(rs.getInt(5));

        checkBoxResponses.add(rb);
    }
}

输出为:rs1=10

rs2=Sam

rs3=Manyu

rs4=manyu

rs5=13621

rs1=10

rs2=Sam
--------------------------
rs3=Manyu

rs4=manyu

rs5=13623
------------------------------------
rs1=10

rs2=Sam US
--------------------------------
rs3=Manyu

rs4=manyu

rs5=13623
-------------------------------------------
rs1=10

rs2=Sam India

rs3=Manyu

rs4=manyu

rs5=13624

我想将 r5=13623 的值映射到 r2=Sam, Sam US 的值。请建议我如何进行此操作以输出为

<13621,Sam>

<13623,(Sam, Sam US)>

<13624, Sam India>
4

1 回答 1

1

您可以使用地图来执行此操作:-

HashMap<Integer, List<String>> myMap = new HashMap<Integer, List<String>>(); //Create the Map
于 2013-03-18T07:10:44.457 回答