Index creation using ArrayList