code: public static <ObjType, Hashable> Collection<ObjType> uniqueNonhashableObjects(Collection<ObjType> objects, Function<ObjType, Hashable> customHasher) {
      Map<Hashable, ObjType> hashesToObjects = new HashMap<Hashable, ObjType>();
      for (ObjType object : objects) {
        hashesToObjects.put(customHasher.apply(object), object);
      }
      return hashesToObjects.values();
    }
docs: Makes it possible to uniquify a collection of objects which are normally
  non-hashable. Alternatively, it lets you define an alternate hash function
  for them for limited-use hashing.