code: public E getOrCreateById(String id, Class<E> type) throws IllegalAccessException, InstantiationException {
          E element = this.getById(id);
          if (element == null) {
              element = type.newInstance();
              element.setId(id);
              this.add(element);
          }
          return element;
      }
docs: Returns the first element in this list with a matching identifier, or adds a new element to the end of this list and sets the identifier
  
  @param id the identifier to search for
  @param type the type of the element to add when no existing element is found. The type MUST have a public no-argument constructor (but it probably does since JAXB requires
  it anyway)
  @return the first element in this list with a matching identifier. Never returns null.
  @throws InstantiationException if the public no-argument constructor of the element type is not visible
  @throws IllegalAccessException if the instance could not be created