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​(java.util.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:
        java.lang.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
      • getCashFlows

        public com.google.common.collect.ImmutableList<CashFlow> getCashFlows()
        Gets the cash flows.

        Each entry includes details of a single cash flow.

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

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object