[SPARK-3161][MLLIB] Adding a node Id caching mechanism for training deci...

...sion trees. @jkbradley @mengxr @chouqin Please review this.
This was one of those thoughtless choices because I didn't think that this will have that much of a performance impact. But I could change this more simply to a mutable Map if you'd like. I think it'll be cheaper and maybe slightly faster, particularly for this collection addition.