A list class is defined as follows:
public class List {
 public Object first; 
 private List rest;
 private List(Object first, List rest){
  this.first = first;
  this.rest = rest;
 public static List cons(Object first, List rest){
  return new List(first, rest);
 public static Object first(List l){
  return l.first;
 public static List rest(List l){
  return l.rest;

A Function interface is defined as follows,
interface Function { Object call(Object o); }

Wondering how to use tail-recursion with a helper function to create a map method which takes a list and a function object, returning a new list containing the results of calling the function's method call on each of the list's elements.