code: @SuppressWarnings("unchecked")
      public static <T> T cleanse(T list, T element) {
          if (list == null || list == element) {
              return null;
          } else if (list instanceof Pair) {
              Pair<T, T> pair = (Pair<T, T>)list;
              if (pair.first == element) {
                  return pair.second;
              } else if (pair.second == element) {
                  return pair.first;
              } else if (pair.second instanceof Pair) {
                  pair.second = cleanse(pair.second, element);
              }
          }
  
          return list;
      }
docs: Cleanses an isomorphic list of a particular element. Only one thread should be updating the list at a time.
  
  Usage: {@code feature = Pair.cleanse(feature, f2);}
  
  @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 remove
  @return the original isomorphic list with the given element cleansed