Here you can find the source of asList(boolean[] array)
public static List<Boolean> asList(boolean[] array)
//package com.java2s; //License from project: Open Source License import java.util.AbstractList; import java.util.Arrays; import java.util.List; public class Main { public static List<Boolean> asList(boolean[] array) { return new AbstractList<Boolean>() { @Override//from w ww. jav a2 s. c o m public int size() { return array.length; } @Override public Boolean get(int index) { return array[index]; } }; } public static List<Character> asList(char[] array) { return new AbstractList<Character>() { @Override public int size() { return array.length; } @Override public Character get(int index) { return array[index]; } }; } public static List<Byte> asList(byte[] array) { return new AbstractList<Byte>() { @Override public int size() { return array.length; } @Override public Byte get(int index) { return array[index]; } }; } public static List<Short> asList(short[] array) { return new AbstractList<Short>() { @Override public int size() { return array.length; } @Override public Short get(int index) { return array[index]; } }; } public static List<Integer> asList(int[] array) { return new AbstractList<Integer>() { @Override public int size() { return array.length; } @Override public Integer get(int index) { return array[index]; } }; } public static List<Long> asList(long[] array) { return new AbstractList<Long>() { @Override public int size() { return array.length; } @Override public Long get(int index) { return array[index]; } }; } public static List<Float> asList(float[] array) { return new AbstractList<Float>() { @Override public int size() { return array.length; } @Override public Float get(int index) { return array[index]; } }; } public static List<Double> asList(double[] array) { return new AbstractList<Double>() { @Override public int size() { return array.length; } @Override public Double get(int index) { return array[index]; } }; } public static List<?> asList(Object array) { if (!array.getClass().isArray()) { throw new IllegalArgumentException("Not an array"); } final Class<?> type = array.getClass().getComponentType(); if (!type.isPrimitive()) { return Arrays.asList((Object[]) array); } else if (boolean.class.equals(type)) { return asList((boolean[]) array); } else if (char.class.equals(type)) { return asList((char[]) array); } else if (byte.class.equals(type)) { return asList((byte[]) array); } else if (short.class.equals(type)) { return asList((short[]) array); } else if (int.class.equals(type)) { return asList((int[]) array); } else if (long.class.equals(type)) { return asList((long[]) array); } else if (float.class.equals(type)) { return asList((float[]) array); } else if (double.class.equals(type)) { return asList((double[]) array); } throw new IllegalArgumentException("Weird array type: " + type); } }