code: @SuppressWarnings("unchecked")
      public static <T> boolean includes(T list, T element) {
          if (list == null) {
              return false;
          } else if (list == element) {
              return true;
          } else if (list instanceof Pair) {
              Pair<T, T> pair = (Pair<T, T>)list;
              if (pair.first == element || pair.second == element) {
                  return true;
              } else if (pair.second instanceof Pair) {
                  return includes(pair.second, element);
              } else {
                  return false;
              }
          } else {
              return false;
          }
      }
docs: Tests whether an isomorphic list includes a particular element.
  
  @param <T> the type of the elements in the isomorphic list
  @param list a list represented by the first Pair object isomorphic to the elements, or an element when the list is trivial
  @param element the element to look for
  @return whether the list includes the element