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 ; }
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