public static <A extends Annotation> Annotation[] unwrapContainerAnnotations(
      final A[] annotations) {
    final List<Annotation> unwrappedAnnotations = new LinkedList<>();
    for (final Annotation maybeContainerAnnotation : annotations) {
      final List<Annotation> indirectlyPresentAnnotations =
          getIndirectlyPresentAnnotations(maybeContainerAnnotation);
      if (!indirectlyPresentAnnotations.isEmpty()) {
        unwrappedAnnotations.addAll(indirectlyPresentAnnotations);
      } else {
        unwrappedAnnotations.add(maybeContainerAnnotation); // was not a container annotation
      }
    }
    return unwrappedAnnotations.toArray(new Annotation[unwrappedAnnotations.size()]);
  }
public static <A extends Annotation> Annotation[] unwrapContainerAnnotations(
      final A[] annotations) {
    final List<Annotation> unwrappedAnnotations = new LinkedList<>();
    for (final Annotation maybeContainerAnnotation : annotations) {
      final List<Annotation> indirectlyPresentAnnotations =
          getIndirectlyPresentAnnotations(maybeContainerAnnotation);
      if (!indirectlyPresentAnnotations.isEmpty()) {
        unwrappedAnnotations.addAll(indirectlyPresentAnnotations);
      } else {
        unwrappedAnnotations.add(maybeContainerAnnotation); 
      }
    }
    return unwrappedAnnotations.toArray(new Annotation[unwrappedAnnotations.size()]);
  }
public static < A extends Annotation > Annotation [ ] unwrapContainerAnnotations ( final A [ ] annotations ) { final List < Annotation > unwrappedAnnotations = new LinkedList <> ( ) ; for ( final Annotation maybeContainerAnnotation : annotations ) { final List < Annotation > indirectlyPresentAnnotations = getIndirectlyPresentAnnotations ( maybeContainerAnnotation ) ; if ( ! indirectlyPresentAnnotations . isEmpty ( ) ) { unwrappedAnnotations . addAll ( indirectlyPresentAnnotations ) ; } else { unwrappedAnnotations . add ( maybeContainerAnnotation ) ; // was not a container annotation } } return unwrappedAnnotations . toArray ( new Annotation [ unwrappedAnnotations . size ( ) ] ) ; }
Returns a new array whose entries do not contain container annotations anymore but the
indirectly present annotation(s) a container annotation was wrapping instead. An annotation is
considered a container annotation if its indirectly present annotation(s) are annotated with
{@link Repeatable}. Annotations inside the given array which don't meet the above definition of
a container annotations will be returned untouched.

@param annotations An array of annotations to unwrap. Can contain both container and non
container annotations.
@return A new array without container annotations but the container annotations' indirectly
defined annotations.
Returns a new array whose entries do not contain container annotations anymore but the indirectly present annotation ( s ) a container annotation was wrapping instead . An annotation is considered a container annotation if its indirectly present annotation ( s ) are annotated with { @link Repeatable } . Annotations inside the given array which don t meet the above definition of a container annotations will be returned untouched .