All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.joda.primitives.collection.BooleanCollection Maven / Gradle / Ivy

The newest version!
/*
 *  Copyright 2001-2010 Stephen Colebourne
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.joda.primitives.collection;

import org.joda.primitives.iterable.BooleanIterable;
import org.joda.primitives.iterator.BooleanIterator;

/**
 * Defines a collection of primitive boolean values.
 * 

* This interface extends {@link java.util.Collection Collection} allowing * seamless integration with other APIs. * All Collection methods can be used, using the primitive wrapper class {@link Boolean}. * However, it will be much more efficient to use the methods defined here. * * @author Stephen Colebourne * @author Jason Tiscione * @version CODE GENERATED * @since 1.0 */ public interface BooleanCollection extends PrimitiveCollection, BooleanIterable { // This file is CODE GENERATED. Do not change manually. // Mandatory operations //----------------------------------------------------------------------- /** * Gets an iterator over this collection capable of accessing the primitive values. * * @return an iterator over this collection, not null */ BooleanIterator iterator(); // This method is specified here, despite being in {@code BooleanIterable}, // due to compiler bug 6487370. /** * Checks whether this collection contains a specified primitive value. * * @param value the value to search for * @return true if the value is found */ boolean contains(boolean value); /** * Checks if this collection contains all of the values in the specified array. * If the specified array is empty, true is returned. * * @param values the values to search for, null treated as empty array * @return true if all of the values are found */ boolean containsAll(boolean[] values); /** * Checks if this collection contains all of the values in the specified collection. * If the specified collection is empty, true is returned. * * @param values the values to search for, null treated as empty collection * @return true if all of the values are found */ boolean containsAll(BooleanCollection values); /** * Checks if this collection contains any of the values in the specified array. * If the specified array is empty, false is returned. * * @param values the values to search for, null treated as empty array * @return true if at least one of the values is found */ boolean containsAny(boolean[] values); /** * Checks if this collection contains any of the values in the specified collection. * If the specified collection is empty, false is returned. * * @param coll the values to search for, null treated as empty collection * @return true if at least one of the values is found */ boolean containsAny(BooleanCollection coll); /** * Gets the elements of this collection as an array. * * @return a new array containing a copy of the elements of this collection */ boolean[] toBooleanArray(); /** * Copies the elements of this collection into an array at a specified position. * Previous values in the array are overwritten. *

* If the array specified is null a new array is created. * If the array specified is large enough, it will be modified. * If the array is not large enough, a new array will be created containing the * values from the specified array before the startIndex plus those from this collection. * * @param array the array to add the elements to, null creates new array * @param startIndex the position in the array to start setting elements * @return the array with the populated collection, not null * @throws IndexOutOfBoundsException if the index is negative */ boolean[] toBooleanArray(boolean[] array, int startIndex); // Optional operations //----------------------------------------------------------------------- /** * Adds a primitive value to this collection (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be added to. * * @param value the value to add to this collection * @return true if this collection was modified by this method call * @throws IllegalArgumentException if value is rejected by this collection * @throws UnsupportedOperationException if not supported by this collection */ boolean add(boolean value); /** * Adds an array of primitive values to this collection (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be added to. * * @param values the values to add to this collection, null treated as empty array * @return true if this collection was modified by this method call * @throws IllegalArgumentException if a value is rejected by this collection * @throws UnsupportedOperationException if not supported by this collection */ boolean addAll(boolean[] values); /** * Adds a collection of primitive values to this collection (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be added to. * * @param values the values to add to this collection, null treated as empty collection * @return true if this collection was modified by this method call * @throws IllegalArgumentException if a value is rejected by this collection * @throws UnsupportedOperationException if not supported by this collection */ boolean addAll(BooleanCollection values); /** * Removes the first occurrence of the specified primitive value from this collection * (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be removed from. * * @param value the value to remove * @return true if this collection was modified by this method call * @throws UnsupportedOperationException if not supported by this collection */ boolean removeFirst(boolean value); /** * Removes all occurrences of the specified primitive value from this collection * (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be removed from. * * @param value the value to remove * @return true if this collection was modified by this method call * @throws UnsupportedOperationException if not supported by this collection */ boolean removeAll(boolean value); /** * Removes all occurrences from this collection of each primitive in the specified array * (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be removed from. * * @param values the values to remove from this collection, null treated as empty array * @return true if this collection was modified by this method call * @throws UnsupportedOperationException if not supported by this collection */ boolean removeAll(boolean[] values); /** * Removes all occurrences from this collection of each primitive in the specified collection * (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be removed from. * * @param values the values to remove from this collection, null treated as empty collection * @return true if this collection was modified by this method call * @throws UnsupportedOperationException if not supported by this collection */ boolean removeAll(BooleanCollection values); /** * Retains each element of this collection that is present in the specified array * removing all other values (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be removed from. * * @param values the values to retain in this collection, null treated as empty array * @return true if this collection was modified by this method call * @throws UnsupportedOperationException if not supported by this collection */ boolean retainAll(boolean[] values); /** * Retains each element of this collection that is present in the specified collection * removing all other values (optional operation). *

* This method is optional, throwing an UnsupportedOperationException if the * collection cannot be removed from. * * @param values the values to retain in this collection, null treated as empty collection * @return true if this collection was modified by this method call * @throws UnsupportedOperationException if not supported by this collection */ boolean retainAll(BooleanCollection values); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy