//------------------------------------------------------------------------- /// <summary> /// Combines this cash flows instance with another cash flow. /// <para> /// This returns a new cash flows instance with a combined list of cash flow instances. /// This instance is immutable and unaffected by this method. /// The result may contain duplicate cash flows. /// /// </para> /// </summary> /// <param name="cashFlow"> the additional single cash flow </param> /// <returns> the new instance of {@code CashFlows} based on this instance, with the additional single cash flow added </returns> public CashFlows combinedWith(CashFlow cashFlow) { return(new CashFlows(ImmutableList.builder <CashFlow>().addAll(cashFlows).add(cashFlow).build())); }
//------------------------------------------------------------------------- /// <summary> /// Obtains an instance from a single cash flow. /// </summary> /// <param name="cashFlow"> The cash flow </param> /// <returns> the cash flows instance </returns> public static CashFlows of(CashFlow cashFlow) { return(CashFlows.of(ImmutableList.of(cashFlow))); }
public virtual void test_serialization() { CashFlow test = CashFlow.ofForecastValue(PAYMENT_DATE, USD, FORECAST_VALUE, DISCOUNT_FACTOR); assertSerialization(test); }