- private Map<QName, Object> readKeyValueMap() throws IOException {
- int count = input.readInt();
- Map<QName, Object> keyValueMap = new HashMap<>(count);
+ private NodeIdentifierWithPredicates readNormalizedNodeWithPredicates() throws IOException {
+ final QName qname = readQName();
+ final int count = input.readInt();
+ switch (count) {
+ case 0:
+ return new NodeIdentifierWithPredicates(qname);
+ case 1:
+ return new NodeIdentifierWithPredicates(qname, readQName(), readObject());
+ default:
+ // ImmutableList is used by ImmutableOffsetMapTemplate for lookups, hence we use that.
+ final Builder<QName> keys = ImmutableList.builderWithExpectedSize(count);
+ final Object[] values = new Object[count];
+ for (int i = 0; i < count; i++) {
+ keys.add(readQName());
+ values[i] = readObject();
+ }