こんにちは私はオブジェクトの2つのArrayListを持っており、それを1つのリストとしてマージする必要があります。これが私の要件です
私のfirstList
ListA
{StaffFirstName=f2, resourceId=2, totalcost=18055.0, totalPercentageInvolvment=550, ResourceCost=2300, staffRole=tl}
およびlistB
{sixthmonth=60, fourthmonth=40, firstmonth=10, fifthmonth=50, secondmonth=20, `thirdmonth=30}`
結果が必要です
結果
{StaffFirstName=f2, resourceId=2, totalcost=18055.0, totalPercentageInvolvment=550, ResourceCost=2300, staffRole=tl, sixthmonth=60, fourthmonth=40, firstmonth=10, fifthmonth=50, secondmonth=20, thirdmonth=30}
編集!
実際、私の両方のリストはarrayListなので、私のlistAは
{StaffFirstName=f2, resourceId=2, totalcost=18055.0, totalPercentageInvolvment=550, ResourceCost=2300, staffRole=tl}
{StaffFirstName=demo35, resourceId=3, totalcost=19625.0, totalPercentageInvolvment=785, ResourceCost=2500, staffRole=sweeper}
リストBは
{sixthmonth=100, fourthmonth=30, firstmonth=40, fifthmonth=25, secondmonth=100, thirdmonth=90}
{sixthmonth=100, fourthmonth=30, firstmonth=40, fifthmonth=25, secondmonth=100, thirdmonth=90}
結果は次のようになります
{StaffFirstName=f2, resourceId=2, totalcost=18055.0, totalPercentageInvolvment=550, ResourceCost=2300, staffRole=tl, sixthmonth=60, fourthmonth=40, firstmonth=10, fifthmonth=50, secondmonth=20, thirdmonth=30}
{StaffFirstName=demo35, resourceId=3, totalcost=19625.0, totalPercentageInvolvment=785, ResourceCost=2500, staffRole=sweeper, sixthmonth=100, fourthmonth=30, firstmonth=40, fifthmonth=25, secondmonth=100, thirdmonth=90}
つまり、2つのリストの各行に、行ごとに追加する必要があります。関数を使用するaddAll
場合、2つのリストは次のように追加します
{StaffFirstName=f2, resourceId=2, totalcost=18055.0, totalPercentageInvolvment=550, ResourceCost=2300, staffRole=tl}
{StaffFirstName=demo35, resourceId=3, totalcost=19625.0, totalPercentageInvolvment=785, ResourceCost=2500, staffRole=sweeper}
{sixthmonth=60, fourthmonth=40, firstmonth=10, fifthmonth=50, secondmonth=20, thirdmonth=30}
{sixthmonth=100, fourthmonth=30, firstmonth=40, fifthmonth=25, secondmonth=100, thirdmonth=90}. But i need to append the two list row wise. Is it possible?