From: Robert Varga Date: Thu, 10 Sep 2015 07:57:46 +0000 (+0200) Subject: Implement ImmutableOffsetMap.toString() X-Git-Tag: release/beryllium~329 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=1a69fa4aa938a9803af1ae3fe35dcbac30e60b8a;p=yangtools.git Implement ImmutableOffsetMap.toString() Previous patch inadvertedly removed the Map-specific implementation of toString() -- as it used to be iunherited from AbstractMap. This patch introduces it back. Change-Id: Id186a75b5e4880461375c8031756461db78fee0e Signed-off-by: Robert Varga --- diff --git a/common/util/src/main/java/org/opendaylight/yangtools/util/ImmutableOffsetMap.java b/common/util/src/main/java/org/opendaylight/yangtools/util/ImmutableOffsetMap.java index f2d34020ca..1366856c77 100644 --- a/common/util/src/main/java/org/opendaylight/yangtools/util/ImmutableOffsetMap.java +++ b/common/util/src/main/java/org/opendaylight/yangtools/util/ImmutableOffsetMap.java @@ -238,6 +238,24 @@ public final class ImmutableOffsetMap implements UnmodifiableMapPhase(this); } + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("{"); + final Iterator it = offsets.keySet().iterator(); + int i = 0; + while (it.hasNext()) { + sb.append(it.next()); + sb.append('='); + sb.append(objects[i++]); + + if (it.hasNext()) { + sb.append(", "); + } + } + + return sb.append('}').toString(); + } + Map offsets() { return offsets; }