BUG-592: Rework instance identifier
This patch reworks the way InstanceIdentifier is implemented, gearing it
up for performance.
The entire implementation is based on Iterables instead of Lists, which
allows us to avoid copying them over and over as we construct new
identifiers. Simple .child() operation is a lot quicker, saving
instantiation of two intermediate classes.
The implementation gets rid of constructors, such that there is no
direct construction, but rather all paths are validated for content.
This also acts as a gate-keeper, enforcing the immutable nature of the
identifier.
Another optimization is that the hashCode() value is now built
incrementally as more members are added and cached.
InstanceIdentifierBuilder, now a full class, does not explictly copy the
base identifier, but reuses it -- there is no reason not to, as the base
identifier is immutable.
Change-Id: I0826ed3169a107c8f4b6e3026569e87387305ce0
Signed-off-by: Robert Varga <rovarga@cisco.com>