web/play-java-forms/src/main/java/play/data/validation/Constraints.java
public static List<Tuple<String, List<Object>>> displayableConstraint(
      Set<ConstraintDescriptor<?>> constraints, Annotation[] orderedAnnotations) {
    final List<Annotation> constraintAnnot =
        constraints.stream().map(c -> c.getAnnotation()).collect(Collectors.<Annotation>toList());

    return Stream.of(orderedAnnotations)
        .filter(
            constraintAnnot
                ::contains) // only use annotations for which we actually have a constraint
        .filter(a -> a.annotationType().isAnnotationPresent(Display.class))
        .map(
            a ->
                displayableConstraint(
                    constraints
                        .parallelStream()
                        .filter(c -> c.getAnnotation().equals(a))
                        .findFirst()
                        .get()))
        .collect(Collectors.toList());
  }
public static List<Tuple<String, List<Object>>> displayableConstraint(
      Set<ConstraintDescriptor<?>> constraints, Annotation[] orderedAnnotations) {
    final List<Annotation> constraintAnnot =
        constraints.stream().map(c -> c.getAnnotation()).collect(Collectors.<Annotation>toList());

    return Stream.of(orderedAnnotations)
        .filter(
            constraintAnnot
                ::contains) // only use annotations for which we actually have a constraint
        .filter(a -> a.annotationType().isAnnotationPresent(Display.class))
        .map(
            a ->
                displayableConstraint(
                    constraints
                        .parallelStream()
                        .filter(c -> c.getAnnotation().equals(a))
                        .findFirst()
                        .get()))
        .collect(Collectors.toList());
  }
Converts a set of constraints to human-readable values in guaranteed order. Only constraints
that have an annotation that intersect with the {@code orderedAnnotations} parameter will be
considered. The order of the returned constraints corresponds to the order of the {@code
orderedAnnotations parameter}.

@param constraints the set of constraint descriptors.
@param orderedAnnotations the array of annotations
@return a list of tuples showing readable constraints.