Java Array Print printOutArrayProperty(String key, E[] property, boolean isDefault)

Here you can find the source of printOutArrayProperty(String key, E[] property, boolean isDefault)

Description

print Out Array Property

License

Open Source License

Declaration

private static <E> void printOutArrayProperty(String key, E[] property, boolean isDefault) 

Method Source Code

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

import java.util.*;

public class Main {
    private final static String FORMAT = "%-60s%s";
    private final static String FORMAT_DEFAULT = "%-80s%s";
    private final static Map<Integer, String> propertiesInUse = new HashMap<>();

    private static <E> void printOutArrayProperty(String key, E[] property, boolean isDefault) {
        StringBuilder value = new StringBuilder();
        for (int i = 0; i < property.length; i++) {
            value.append(property[i].toString());
            if (i != property.length - 1) {
                value.append(",");
            }/*  ww w. j a  va  2 s.c  o  m*/
        }
        if (isDefault) {
            printOutLine(String.format(FORMAT_DEFAULT, key, " = " + value.toString()));
        } else {
            printOutLine(String.format(FORMAT, key, " = " + value.toString()));
        }

    }

    private static void printOutLine(String line) {
        propertiesInUse.put(propertiesInUse.size() + 1, line);

    }
}

Related

  1. printFloatArray(float[] arr)
  2. printFloatArray(float[] array)
  3. println(int[] array)
  4. println(Object[] objs)
  5. printMap1(String[] s)
  6. printParameterMap(Map parameters)
  7. printPoint(double[] ds)
  8. printUsage(String[] args)
  9. printVector(T array[])