summaryrefslogtreecommitdiff
path: root/libjava/classpath/java/util/Arrays.java
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-15 23:20:01 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-15 23:20:01 +0000
commit3b3101d8b5ae4f08a16c0b7111da6cad41bbd282 (patch)
treea5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/java/util/Arrays.java
parent7e55c49d7d91ef9f09e93c1100119b1ab3652446 (diff)
downloadgcc-3b3101d8b5ae4f08a16c0b7111da6cad41bbd282.tar.gz
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/util/Arrays.java')
-rw-r--r--libjava/classpath/java/util/Arrays.java180
1 files changed, 180 insertions, 0 deletions
diff --git a/libjava/classpath/java/util/Arrays.java b/libjava/classpath/java/util/Arrays.java
index 15c1a5f33bf..b28c156b46e 100644
--- a/libjava/classpath/java/util/Arrays.java
+++ b/libjava/classpath/java/util/Arrays.java
@@ -2353,6 +2353,186 @@ public class Arrays
}
/**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (long[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (int[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (short[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (char[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (byte[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (boolean[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (float[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (double[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the argument array. Returns "null"
+ * if <code>a</code> is null.
+ * @param a the array to represent
+ * @return a String representing this array
+ * @since 1.5
+ */
+ public static String toString (Object[] a)
+ {
+ if (a == null)
+ return "null";
+ if (a.length == 0)
+ return "[]";
+ String result = "[";
+ for (int i = 0; i < a.length - 1; i++)
+ result += String.valueOf(a[i]) + ", ";
+ result += String.valueOf(a[a.length - 1]) + "]";
+ return result;
+ }
+
+ /**
* Inner class used by {@link #asList(Object[])} to provide a list interface
* to an array. The name, though it clashes with java.util.ArrayList, is
* Sun's choice for Serialization purposes. Element addition and removal