/**
  * Enumerates all registered token types which match the specified predicate.
  *
  * @param p the predicate which should be matched by the element types.
  * @return the array of matching element types.
  */
 @NotNull
 public static IElementType[] enumerate(@NotNull Predicate p) {
   List<IElementType> matches = new ArrayList<IElementType>();
   for (IElementType value : ourRegistry) {
     if (value != null && p.matches(value)) {
       matches.add(value);
     }
   }
   return matches.toArray(new IElementType[matches.size()]);
 }
 /**
  * Enumerates all registered token types which match the specified predicate.
  *
  * @param p the predicate which should be matched by the element types.
  * @return the array of matching element types.
  */
 public static IElementType[] enumerate(Predicate p) {
   List<IElementType> matches = new ArrayList<IElementType>();
   IElementType[] copy;
   synchronized (ourRegistry) {
     copy = ourRegistry.toArray(new IElementType[ourRegistry.size()]);
   }
   for (IElementType value : copy) {
     if (p.matches(value)) {
       matches.add(value);
     }
   }
   return matches.toArray(new IElementType[matches.size()]);
 }