Lets say i have two different Strings of given pojo type.
 List 1 = "one", "two", "three", "four", "five".
 List 2 = "one", "two", "four", "five".
I wants to retrieve a string that doesn't found in another list and add it into another list(say List 3). how can i do this?
i'm trying this:-
 for ( SettlementReportNB showSellementReport : settlementReportList )
        {
            String merchantreferencenumber = showSellementReport.getMerchantreferencenumber();
            for ( AllTransactions showAllTransaction : allTransactionsList )
            {
                String merchantTxnId = showAllTransaction.getMerchantTxnId();
                if ( !merchantreferencenumber.equals( merchantTxnId ) )
                {
                    idNotFound.add( merchantTxnId );
                }
            }
        }
but it is not giving me an expected answer.
- Answer should be "three" because it is not present in another list.
 
     
     
     
     
     
     
     
    