code: public Timestamp[] toArray(Timestamp[] a) {
          int n = data.size();
          if (a.length < n) {
              a = new Timestamp[n];
          }
          
          for (int i = 0; i < n; i++) {
              a[i] = data.get(i).timestamp;
          }
          
          for (int i = n; i < a.length; i++) {
              a[i] = null;
          }
          
          return a;
      }
docs: Returns an array containing the timestamps of the elements in this
  dataset in proper sequence (from first to last element). If the dataset
  fits in the specified array, it is returned therein. Otherwise, a new
  array is allocated with the size of this dataset.
  <p>
  If the dataset fits in the specified array with room to spare (i.e., the
  array has more elements than the dataset), the element in the array
  immediately following the end of the dataset is set to null.
  
  @param a the array into which the timestamps of the elements in this
  dataset are to be stored, if it is big enough; otherwise, a new array
  is allocated for this purpose.
  @return an array containing the timestamps of the elements in this dataset.