From b231e930a4c4dfff7b95633a564d40663378d0f1 Mon Sep 17 00:00:00 2001 From: mdb Date: Wed, 25 Jun 2003 22:03:55 +0000 Subject: [PATCH] Implement goddamn motherfucking toString(). git-svn-id: https://samskivert.googlecode.com/svn/trunk@1152 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../java/com/samskivert/util/IntIntMap.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/projects/samskivert/src/java/com/samskivert/util/IntIntMap.java b/projects/samskivert/src/java/com/samskivert/util/IntIntMap.java index b5ebd1dd..45f391bf 100644 --- a/projects/samskivert/src/java/com/samskivert/util/IntIntMap.java +++ b/projects/samskivert/src/java/com/samskivert/util/IntIntMap.java @@ -1,5 +1,5 @@ // -// $Id: IntIntMap.java,v 1.6 2003/03/18 19:50:49 ray Exp $ +// $Id: IntIntMap.java,v 1.7 2003/06/25 22:03:55 mdb Exp $ // // samskivert library - useful routines for java programs // Copyright (C) 2001 Michael Bayne @@ -175,6 +175,22 @@ public class IntIntMap return toIntArray(false); } + /** + * Returns a string representation of this instance. + */ + public String toString () + { + StringBuffer buf = new StringBuffer("["); + int[] keys = getKeys(); + for (int ii = 0; ii < keys.length; ii++) { + if (ii > 0) { + buf.append(", "); + } + buf.append(keys[ii]).append("->").append(get(keys[ii])); + } + return buf.append("]").toString(); + } + protected int[] toIntArray (boolean keys) { int[] ret = new int[_size];