You can't. Chars are primitives and so they don't have an identity (unless there's boxing involved but even then it's still a bad idea to depend on identity anyway). In this case you could check the index instead:
if (indice == composizione.lastIndex)