Class Misc


  • public abstract class Misc
    extends java.lang.Object
    Random useful stuff
    Author:
    Sean D. Reilly; $Author: sreilly $ $Date: 2001/10/01 16:04:55 $ $Revision: 1.2 $ ------------------------------------------------------------------------
    • Constructor Summary

      Constructors 
      Constructor Description
      Misc()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> boolean addNoDuplicates​(java.util.List<T> list, T candidate)
      Add an item to a list, checking for duplicates.
      static <T> boolean isEqual​(T object1, T object2)
      Determine if two objects of the same type are equal or not.
      static boolean isZero​(long[] values, int columnCount)
      Determine if all the values in an array are zero or not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Misc

        public Misc()
    • Method Detail

      • isEqual

        public static <T> boolean isEqual​(T object1,
                                          T object2)
        Determine if two objects of the same type are equal or not.
        Type Parameters:
        T - The type of object being compared.
        Parameters:
        object1 - Left hand side object.
        object2 - Right hand side object.
        Returns:
        True if the objects are equal, false otherwise.
      • addNoDuplicates

        public static <T> boolean addNoDuplicates​(java.util.List<T> list,
                                                  T candidate)
        Add an item to a list, checking for duplicates. If the item is duplicated, it is not added and false is returned. This allows you to use a List container like a Set. There are situations where the List interface is more useful than the Set interface, but you cannot allow duplicates.
        Type Parameters:
        T - The type of object contained by list.
        Parameters:
        list - The list to add the item to.
        candidate - The candidate item.
        Returns:
        True if the item was added, false if it already exists so it was not added again.
      • isZero

        public static boolean isZero​(long[] values,
                                     int columnCount)
        Determine if all the values in an array are zero or not. Please note that this is only available since Moneydance build 754
        Parameters:
        values - The array to check.
        columnCount - Number of array values to check
        Returns:
        True if all values are zero, false if one or more values is non-zero.
        Since:
        Moneydance build 754