Java BitSet isEmptySet(BitSet setToTest)

Here you can find the source of isEmptySet(BitSet setToTest)

Description

Test if the given set is empty

License

Open Source License

Parameter

Parameter Description
setToTest the set we're testing to see if it's empty

Exception

Parameter Description
NullPointerException if the given set to test is null

Return

true iff its empty

Declaration

public static boolean isEmptySet(BitSet setToTest) throws NullPointerException 

Method Source Code

//package com.java2s;
/*//w w  w .  j av  a2 s .c o m
 * Copyright (c) 2010 The Jackson Laboratory
 * 
 * This is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this software.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.BitSet;

public class Main {
    /**
     * A bit set that's empty
     */
    private static final BitSet EMPTY_BIT_SET = new BitSet(0);

    /**
     * Test if the given set is empty
     * @param setToTest
     *          the set we're testing to see if it's empty
     * @return
     *          true iff its empty
     * @throws NullPointerException
     *          if the given set to test is null
     */
    public static boolean isEmptySet(BitSet setToTest) throws NullPointerException {
        return setToTest.equals(EMPTY_BIT_SET);
    }
}

Related

  1. increment(BitSet bits, int size)
  2. insertBits(BitSet fromSet, int insertBefore, int count)
  3. intArrToBitSet(ArrayList integerArray)
  4. intToBitSet(int value)
  5. invertInPlace(BitSet bs, int n)
  6. isHammingDistanceOne(BitSet a, BitSet b)
  7. isSet(int n, BitSet... sets)
  8. isSubset(BitSet bits1, BitSet bits2)
  9. isSubset(BitSet subsetToTest, BitSet supersetToTest)