code: public static <T> List<T> reverse(List<T> self, boolean mutate) {
          if (mutate) {
              Collections.reverse(self);
              return self;
          }
          int size = self.size();
          List<T> answer = new ArrayList<T>(size);
          ListIterator<T> iter = self.listIterator(size);
          while (iter.hasPrevious()) {
              answer.add(iter.previous());
          }
          return answer;
      }
docs: Reverses the elements in a list. If mutate is true, the original list is modified in place and returned.
  Otherwise, a new list containing the reversed items is produced.
  <pre class="groovyTestCase">
  def list = ["a", 4, false]
  assert list.reverse(false) == [false, 4, "a"]
  assert list == ["a", 4, false]
  assert list.reverse(true) == [false, 4, "a"]
  assert list == [false, 4, "a"]
  </pre>
  
  @param self a List
  @param mutate true if the list itself should be reversed in place and returned, false if a new list should be created
  @return a reversed List
  @since 1.8.1