Implement goddamn motherfucking toString().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1152 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -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
|
// samskivert library - useful routines for java programs
|
||||||
// Copyright (C) 2001 Michael Bayne
|
// Copyright (C) 2001 Michael Bayne
|
||||||
@@ -175,6 +175,22 @@ public class IntIntMap
|
|||||||
return toIntArray(false);
|
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)
|
protected int[] toIntArray (boolean keys)
|
||||||
{
|
{
|
||||||
int[] ret = new int[_size];
|
int[] ret = new int[_size];
|
||||||
|
|||||||
Reference in New Issue
Block a user