Java Array to List toList(boolean... booleans)

Here you can find the source of toList(boolean... booleans)

Description

to List

License

Open Source License

Declaration

public static List<Boolean> toList(boolean... booleans) 

Method Source Code


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

import java.util.*;

public class Main {
    public static List<Boolean> toList(boolean... booleans) {
        List<Boolean> list = new ArrayList<>();
        for (boolean b : booleans) {
            list.add(b);/*  w w w  .j  av a2  s .  co m*/
        }
        return list;
    }

    public static List<Character> toList(char... chars) {
        List<Character> list = new ArrayList<>();
        for (char b : chars) {
            list.add(b);
        }
        return list;
    }

    public static List<Short> toList(short... shorts) {
        List<Short> list = new ArrayList<>();
        for (short b : shorts) {
            list.add(b);
        }
        return list;
    }

    public static List<Integer> toList(int... ints) {
        List<Integer> list = new ArrayList<>();
        for (int i : ints) {
            list.add(i);
        }
        return list;
    }

    public static List<Long> toList(long... longs) {
        List<Long> list = new ArrayList<>();
        for (long l : longs) {
            list.add(l);
        }
        return list;
    }

    public static List<Float> toList(float... floats) {
        List<Float> list = new ArrayList<>();
        for (float f : floats) {
            list.add(f);
        }
        return list;
    }

    public static List<Double> toList(double... doubles) {
        List<Double> list = new ArrayList<>();
        for (double d : doubles) {
            list.add(d);
        }
        return list;
    }

    public static List<Byte> toList(byte... bytes) {
        List<Byte> list = new ArrayList<>();
        for (byte b : bytes) {
            list.add(b);
        }
        return list;
    }
}

Related

  1. newList(T... objs)
  2. newList(T... ts)
  3. newList(T... values)
  4. newList(V... items)
  5. toList(@SuppressWarnings("unchecked") T... ts)
  6. toList(boolean[] array)
  7. toList(boolean[] array)
  8. toList(Boolean[] list)
  9. toList(byte[] array)