Java ArrayList Print print(ArrayList l)

Here you can find the source of print(ArrayList l)

Description

print

License

Open Source License

Declaration

public static void print(ArrayList<Double> l) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

public class Main {
    public static void print(ArrayList<Double> l) {
        String s = "[";
        for (int i = 0; i < l.size(); i++) {
            s += l.get(i);//from   w  w  w. j a  v  a2s . c o m
            if (i < l.size() - 1)
                s += ", ";
        }
        s += "]";
        System.out.println(s);
    }

    public static void print(double[] l) {
        String s = "[";
        for (int i = 0; i < l.length; i++) {
            s += l[i];
            if (i < l.length - 1)
                s += ", ";
        }
        s += ", ...]";
        System.out.println(s);
    }

    public static void print(double[] l, int limit) {
        String s = "[";
        for (int i = 0; i < limit; i++) {
            s += l[i];
            if (i < limit - 1)
                s += ", ";
        }
        s += ", ...]";
        System.out.println(s);
    }

    public static void print(ArrayList<Double> l, int limit) {
        String s = "[";
        for (int i = 0; i < limit; i++) {
            s += l.get(i);
            if (i < limit - 1)
                s += ", ";
        }
        s += "]";
        System.out.println(s);
    }
}

Related

  1. prettyPrintArrayList(ArrayList input)
  2. print(ArrayList array)
  3. print(ArrayList tokens)
  4. print(ArrayList tokens)
  5. print(ArrayList[] al)
  6. print(ArrayList lines, int targetColumn)
  7. print(ArrayList tokens, String symbol)
  8. printArray(ArrayList array)