Class CashFlows

    • Field Detail

      • NONE

        public static final CashFlows NONE
        A cash flows instance to be used when there is no cash flow.
    • Method Detail

      • of

        public static CashFlows of​(CashFlow cashFlow)
        Obtains an instance from a single cash flow.
        Parameters:
        cashFlow - The cash flow
        Returns:
        the cash flows instance
      • of

        public static CashFlows of​(List<CashFlow> cashFlows)
        Obtains an instance from a list of cash flows.
        Parameters:
        cashFlows - the list of cash flows
        Returns:
        the cash flows instance
      • getCashFlow

        public CashFlow getCashFlow​(int index)
        Gets the cash flow by index.
        Parameters:
        index - the index to get
        Returns:
        the cash flow
      • combinedWith

        public CashFlows combinedWith​(CashFlow cashFlow)
        Combines this cash flows instance with another cash flow.

        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.

        Parameters:
        cashFlow - the additional single cash flow
        Returns:
        the new instance of CashFlows based on this instance, with the additional single cash flow added
      • combinedWith

        public CashFlows combinedWith​(CashFlows other)
        Combines this cash flows instance with another one.

        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.

        Parameters:
        other - the other cash flows
        Returns:
        the new instance of CashFlows based on this instance, with the other instance added
      • sorted

        public CashFlows sorted()
        Returns an instance that is sorted.

        The sort is by date, then value.

        Returns:
        the sorted instance
      • convertedTo

        public CashFlows convertedTo​(Currency resultCurrency,
                                     FxRateProvider rateProvider)
        Converts this collection of cash flows to an equivalent amount in the specified currency.

        This ensures that the result will have all currency amounts expressed in terms of the given currency. If conversion is needed, the provider will be used to supply the FX rate.

        Specified by:
        convertedTo in interface FxConvertible<CashFlows>
        Parameters:
        resultCurrency - the currency of the result
        rateProvider - the provider of FX rates
        Returns:
        the converted instance, in the specified currency
        Throws:
        RuntimeException - if no FX rate could be found
      • meta

        public static CashFlows.Meta meta()
        The meta-bean for CashFlows.
        Returns:
        the meta-bean, not null
      • metaBean

        public CashFlows.Meta metaBean()
        Specified by:
        metaBean in interface org.joda.beans.Bean
      • getCashFlows

        public ImmutableList<CashFlow> getCashFlows()
        Gets the cash flows.

        Each entry includes details of a single cash flow.

        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object