code: public <T extends RedGEntity> List<T> findEntities(final Class<T> type, final Predicate<T> filter) {
          return this.entities.stream()
                  .filter(obj -> Objects.equals(type, obj.getClass()))
                  .map(type::cast)
                  .filter(filter)
                  .collect(Collectors.toList());
      }
docs: Searches through the list of entities to insert into the database and returns all of the specified type that match the passed {@link Predicate}.
  
  @param type   The class of the entities that should be searched for
  @param filter A predicate that gets called for every entity that has the requested type. An entity gets added to the entities returned by this method if
  the predicate returns {@code true}
  @param <T>    The entity type
  @return A list of all entities of the requested type that match the predicate