Java Array Print printArray(T[] array)

Here you can find the source of printArray(T[] array)

Description

print Array

License

Open Source License

Declaration

public static <T> void printArray(T[] array) 

Method Source Code


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

import java.util.Arrays;

public class Main {
    public static <T> void printArray(T[] array) {
        printArray(array, 0, array.length);
    }//  www  .j a  va  2 s.c  o m

    public static <T> void printArray(T[] array, int start, int stop) {
        Arrays.stream(Arrays.copyOfRange(array, start, stop)).map(s -> s + " ").forEach(System.out::print);
        System.out.println();
    }

    public static void printArray(int[] array) {
        printArray(array, 0, array.length);
    }

    public static void printArray(int[] array, int start, int stop) {
        for (int i : Arrays.copyOfRange(array, start, stop)) {
            System.out.print(i + " ");
        }
        System.out.println();
    }
}

Related

  1. printArray(String[] arr, char separator)
  2. printArray(String[] s)
  3. printArray(String[] s)
  4. printArray(T[] arr)
  5. printArray(T[] array)
  6. printArrayElements(T[] array)
  7. printArrayFrom(int[] array, int start)
  8. printArrayInfo(int[] array)
  9. printArrayNoSpaces(int[] nums)