Class JRCloneUtils


  • public final class JRCloneUtils
    extends java.lang.Object
    Cloning related utility methods.
    Author:
    Lucian Chirita (lucianc@users.sourceforge.net)
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T extends JRCloneable>
      T[]
      cloneArray​(T[] items)
      Clones a list of objects.
      static <T extends JRCloneable>
      java.util.List<T>
      cloneList​(java.util.List<T> items)
      Clones a list of objects.
      static <T extends JRCloneable>
      T
      nullSafeClone​(T original)
      Clones an object after checking whether the argument is null.
      • Methods inherited from class java.lang.Object

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

      • nullSafeClone

        public static <T extends JRCloneable> T nullSafeClone​(T original)
        Clones an object after checking whether the argument is null.
        Parameters:
        original - the object to be cloned
        Returns:
        a clone of the argument, or null if the argument was null
      • cloneList

        public static <T extends JRCloneable> java.util.List<T> cloneList​(java.util.List<T> items)
        Clones a list of objects. The list elements are assumed to implement JRCloneable.
        Parameters:
        items - the list to clone
        Returns:
        a new list which contains clones of the elements in the original list
      • cloneArray

        public static <T extends JRCloneable> T[] cloneArray​(T[] items)
        Clones a list of objects. The list elements are assumed to implement JRCloneable.
        Parameters:
        items - the list to clone
        Returns:
        a new list which contains clones of the elements in the original list