class CompositeRepresentation implements Representation {

  private final List<Representation> representations;

  public CompositeRepresentation(List<Representation> representations) {
    if (representations == null) throw new IllegalArgumentException("The given representations should not be null");
    this.representations = representations.stream()
                                          .sorted(comparingInt(Representation::getPriority).reversed())
                                          .collect(toList());
  }

  @Override
  public String toStringOf(Object object) {<FILL_FUNCTION_BODY>}

  @Override
  public String unambiguousToStringOf(Object object) {
    // don't create streams for performance reasons and because this code is simple enough (even not as elegant as with stream)
    for (Representation representation : representations) {
      String value = representation.unambiguousToStringOf(object);
      if (value != null) return value;
    }
    return STANDARD_REPRESENTATION.unambiguousToStringOf(object);
  }

  @Override
  public String toString() {
    return representations.isEmpty() ? STANDARD_REPRESENTATION.toString() : representations.toString();
  }

  public List<Representation> getAllRepresentationsOrderedByPriority() {
    List<Representation> representationsOrderedByPriority = new ArrayList<>(representations);
    representationsOrderedByPriority.add(STANDARD_REPRESENTATION);
    return representationsOrderedByPriority;
  }
}

    // don't create streams for performance reasons and because this code is simple enough (even not as elegant as with stream)
    for (Representation representation : representations) {
      String value = representation.toStringOf(object);
      if (value != null) return value;
    }
    return STANDARD_REPRESENTATION.toStringOf(object);
  
<no_super_class>