new arraylist implementation, porting it for the lexer