Java Collection to Array asBooleanArray(Collection collection)

Here you can find the source of asBooleanArray(Collection collection)

Description

as Boolean Array

License

Open Source License

Declaration

public static boolean[] asBooleanArray(Collection<Boolean> collection) 

Method Source Code


//package com.java2s;
// it under the terms of the GNU Lesser General Public License as published by

import java.util.Collection;
import java.util.Iterator;

public class Main {
    public static boolean[] asBooleanArray(Collection<Boolean> collection) {
        boolean[] array = new boolean[collection.size()];
        Iterator<Boolean> iterator = collection.iterator();
        int i = 0;
        while (iterator.hasNext()) {
            array[i++] = iterator.next();
        }/*w w w.  java 2s . co  m*/
        return array;
    }
}

Related

  1. asArray(Collection c)
  2. asArray(Collection collection, E[] a)
  3. asLongArray(final Collection ls)
  4. asLongArray(java.util.Collection c)
  5. collectionToArray(Collection collection)
  6. collectionToIntArray(Collection c)