Class Calculations


  • public class Calculations
    extends Object
    A utility class for the pivot package.
    Author:
    jumperchen
    • Constructor Detail

      • Calculations

        public Calculations()
    • Method Detail

      • compare

        public static int compare​(Object o1,
                                  Object o2)
        A common compareTo method for String, Date, Float, Double, Integer, Long, Short, Byte, Calendar, and Boolean. Otherwise Object.toString() will be assumed.
      • sum

        public static Number sum​(Collection<Object> data)
        A common sum method for Double, Float, Integer, Long, Short, and Byte. Otherwise, it will count the data length.
      • getNonNullValues

        public static Collection<Object> getNonNullValues​(Collection<Object> data)
        Filter the array to return an array containing only non null values
      • getNumericValues

        public static List<Number> getNumericValues​(Collection<Object> data,
                                                    boolean strict)
        Filter the array to return an array containing only numeric values