Insert Bean into list at certain point
<p>Ok this is what Im doing, I got a list of beans and im checking to see if in that list there are at least 2 beans with the getter that returns "MCA" and "MCB"...so I can bulid a "total" bean just for them two called "MDMC TOTAL"...im also making a "grand total" bean row at the very end.</p>

<p>My issue here is just the "MDMC TOTAL"  I need to add that bean to the list after "MCB" in the  original list instead of how im doing it at the very end.  Any help is appreciated:</p>

<p><img src="http://i.stack.imgur.com/4UuNB.png" alt="enter image description here"></p>

<p>*rollup is not empty :)....</p>

<pre><code>rollup = new ArrayList&lt;AppropriationScheduleBean&gt;();
            beans = dao.getAppropriationSummaryBySor(criteria, rollup);

           //Here we are setting up lists to be used to be added to the bottom of "Rollup" as "Totals" 
           List&lt;AppropriationScheduleBean&gt; mdmcList = new ArrayList&lt;AppropriationScheduleBean&gt;();
           List&lt;AppropriationScheduleBean&gt; grandList = new ArrayList&lt;AppropriationScheduleBean&gt;();
            for (AppropriationScheduleBean b: rollup)
            {
                //We need 2 beans...one with MCA and one with MCB
                if( b.getSor().getShortName().equals("MCA") || b.getSor().getShortName().equals("MCB"))
                {
                    mdmcList.add(b);
                }
                grandList.add(b);
            }
            // Create MDMC totals bean.
            if (mdmcList.size() &gt; 1 )
            {
                AppropriationScheduleBean mdmcTotals = new AppropriationScheduleBean();
                mdmcTotals.setSor(MDMC_TOTALS_SOR);

                for (AppropriationScheduleBean bean : mdmcList)
                {
                    mdmcTotals.setQuantity(MgmtviewBO.totalsIntegerAdd(mdmcTotals.getQuantity(),
                                                                   bean.getQuantity()));
                    mdmcTotals.setHours(MgmtviewBO.totalsDoubleAdd(mdmcTotals.getHours(),
                                                                    bean.getHours()));
                    mdmcTotals.setDollars(MgmtviewBO.totalsBigDecimalAdd(mdmcTotals.getDollars(),
                                                                    bean.getDollars()));
                }
                rollup.add(mdmcTotals); 
            }

            // Create Grand Totals bean.
            if (grandList.size() &gt; 1 )
            {
                AppropriationScheduleBean grandTotals = new AppropriationScheduleBean();
                grandTotals.setSor(GRAND_TOTALS_SOR);

                for (AppropriationScheduleBean bean : grandList)
                {
                    grandTotals.setQuantity(MgmtviewBO.totalsIntegerAdd(grandTotals.getQuantity(),
                                                                   bean.getQuantity()));
                    grandTotals.setHours(MgmtviewBO.totalsDoubleAdd(grandTotals.getHours(),
                                                                    bean.getHours()));
                    grandTotals.setDollars(MgmtviewBO.totalsBigDecimalAdd(grandTotals.getDollars(),
                                                                    bean.getDollars()));
                }
                rollup.add(grandTotals); 
            }





request.setAttribute("rollup", rollup);
</code></pre>
