code: public static <T extends Object> T cloneSerializable(T source) {
          ByteArrayOutputStream baos = null;
          ObjectOutputStream oos = null;
          ByteArrayInputStream bais = null;
          ObjectInputStream ois = null;
          try {
              baos = new ByteArrayOutputStream();
              oos = new ObjectOutputStream(baos);
              oos.writeObject(source);
  
              bais = new ByteArrayInputStream(baos.toByteArray());
              ois = new ObjectInputStream(bais);
              return (T) ois.readObject();
          } catch (IOException e) {
              return null;
          } catch (ClassNotFoundException e) {
              return null;
          } finally {
              closeQuietly(baos, oos, bais, ois);
          }
      }
docs: Helper method to clone a serializable object.
  
  @param source the serializable object to clone.
  @param <T>    The class of the serializable object.
  @return a clone of the given source object.