Class Percentage

    • Constructor Detail

      • Percentage

        public Percentage​(java.lang.String rate)
        Creates a new percentage with the specified rate.
      • Percentage

        public Percentage​(int rate)
        Creates a new percentage with the specified rate.
      • Percentage

        public Percentage​(java.math.BigDecimal rate)
        Creates a new percentage with the specified rate.
    • Method Detail

      • valueOf

        public static java.util.List<Percentage> valueOf​(java.lang.String... rates)
        Creates a list percentages from the given String values.
      • valueOf

        public static java.util.List<Percentage> valueOf​(int... rates)
        Creates a list percentages from the given int values.
      • valueOf

        public static java.util.List<Percentage> valueOf​(java.math.BigDecimal... rates)
        Creates a list percentages from the given BigDecimal values.
      • getRate

        public java.math.BigDecimal getRate()
        Returns the percentage rate.
      • add

        public Percentage add​(Percentage percentage)
        Adds a percentage to current and returns the sum as new object.
      • subtract

        public Percentage subtract​(Percentage percentage)
        Subtracts a percentage to current and returns the result as new object.
      • hashCode

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

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

        public static final Percentage sum​(java.util.Collection<Percentage> elements)
        Sums a list of percentages.
      • split

        public java.util.List<Percentage> split​(int parts)
        Splits this percentage into the specified number of parts.