code: public <U extends T> List<U> getAll(Class<U> type) {
          List<U> r = new ArrayList<>();
          for (T t : data)
              if(type.isInstance(t))
                  r.add(type.cast(t));
          return r;
      }
docs: Gets all instances that matches the given type.