org.joda.primitives.collection
Interface ShortCollection

All Superinterfaces:
Collection<Short>, Iterable<Short>, PrimitiveCollectable<Short>, PrimitiveCollection<Short>, ShortIterable
All Known Subinterfaces:
ShortList
All Known Implementing Classes:
AbstractShortCollection, AbstractShortList, ArrayShortCollection, ArrayShortList, ImmutableArrayShortList

public interface ShortCollection
extends PrimitiveCollection<Short>, ShortIterable

Defines a collection of primitive short values.

This interface extends Collection allowing seamless integration with other APIs. All Collection methods can be used, using the primitive wrapper class Short. However, it will be much more efficient to use the methods defined here.

Since:
1.0
Version:
CODE GENERATED
Author:
Stephen Colebourne, Jason Tiscione

Method Summary
 boolean add(short value)
          Adds a primitive value to this collection (optional operation).
 boolean addAll(short[] values)
          Adds an array of primitive values to this collection (optional operation).
 boolean addAll(ShortCollection values)
          Adds a collection of primitive values to this collection (optional operation).
 boolean addAll(short startInclusive, short endInclusive)
          Adds a range of primitive values to this collection (optional operation).
 boolean contains(short value)
          Checks whether this collection contains a specified primitive value.
 boolean containsAll(short[] values)
          Checks if this collection contains all of the values in the specified array.
 boolean containsAll(ShortCollection values)
          Checks if this collection contains all of the values in the specified collection.
 boolean containsAll(short startInclusive, short endInclusive)
          Checks if this collection contain all the values in the specified range.
 boolean containsAny(short[] values)
          Checks if this collection contains any of the values in the specified array.
 boolean containsAny(ShortCollection coll)
          Checks if this collection contains any of the values in the specified collection.
 boolean containsAny(short startInclusive, short endInclusive)
          Checks if this collection contain any of the values in the specified range.
 ShortIterator iterator()
          Gets an iterator over this collection capable of accessing the primitive values.
 boolean removeAll(short value)
          Removes all occurrences of the specified primitive value from this collection (optional operation).
 boolean removeAll(short[] values)
          Removes all occurrences from this collection of each primitive in the specified array (optional operation).
 boolean removeAll(ShortCollection values)
          Removes all occurrences from this collection of each primitive in the specified collection (optional operation).
 boolean removeAll(short startInclusive, short endInclusive)
          Removes all occurrences of a range of primitive values from this collection (optional operation).
 boolean removeFirst(short value)
          Removes the first occurrence of the specified primitive value from this collection (optional operation).
 boolean retainAll(short[] values)
          Retains each element of this collection that is present in the specified array removing all other values (optional operation).
 boolean retainAll(ShortCollection values)
          Retains each element of this collection that is present in the specified collection removing all other values (optional operation).
 boolean retainAll(short startInclusive, short endInclusive)
          Retains all occurrences of a range of primitive values within this collection removing all values outside the range (optional operation).
 short[] toShortArray()
          Gets the elements of this collection as an array.
 short[] toShortArray(short[] array, int startIndex)
          Copies the elements of this collection into an array at a specified position.
 
Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection
containsAny
 
Methods inherited from interface org.joda.primitives.PrimitiveCollectable
clear, clone, isEmpty, isModifiable, optimize, size
 
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
 

Method Detail

iterator

ShortIterator iterator()
Gets an iterator over this collection capable of accessing the primitive values.

Specified by:
iterator in interface Collection<Short>
Specified by:
iterator in interface Iterable<Short>
Specified by:
iterator in interface ShortIterable
Returns:
an iterator over this collection, not null

contains

boolean contains(short value)
Checks whether this collection contains a specified primitive value.

Parameters:
value - the value to search for
Returns:
true if the value is found

containsAll

boolean containsAll(short[] values)
Checks if this collection contains all of the values in the specified array. If the specified array is empty, true is returned.

Parameters:
values - the values to search for, null treated as empty array
Returns:
true if all of the values are found

containsAll

boolean containsAll(ShortCollection values)
Checks if this collection contains all of the values in the specified collection. If the specified collection is empty, true is returned.

Parameters:
values - the values to search for, null treated as empty collection
Returns:
true if all of the values are found

containsAll

boolean containsAll(short startInclusive,
                    short endInclusive)
Checks if this collection contain all the values in the specified range.

The range is defined to be inclusive of the start and end. If the start is greater than the end then the result is true as the range is equivalent to an empty collection.

Parameters:
startInclusive - the inclusive range start value
endInclusive - the inclusive range end value
Returns:
true if the collection contains the entire range

containsAny

boolean containsAny(short[] values)
Checks if this collection contains any of the values in the specified array. If the specified array is empty, false is returned.

Parameters:
values - the values to search for, null treated as empty array
Returns:
true if at least one of the values is found

containsAny

boolean containsAny(ShortCollection coll)
Checks if this collection contains any of the values in the specified collection. If the specified collection is empty, false is returned.

Parameters:
coll - the values to search for, null treated as empty collection
Returns:
true if at least one of the values is found

containsAny

boolean containsAny(short startInclusive,
                    short endInclusive)
Checks if this collection contain any of the values in the specified range.

The range is defined to be inclusive of the start and end. If the start is greater than the end then the result is false as the range is equivalent to an empty collection.

Parameters:
startInclusive - the inclusive range start value
endInclusive - the inclusive range end value
Returns:
true if the collection contains at least one of the range

toShortArray

short[] toShortArray()
Gets the elements of this collection as an array.

Returns:
a new array containing a copy of the elements of this collection

toShortArray

short[] toShortArray(short[] array,
                     int startIndex)
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.

Parameters:
array - the array to add the elements to, null creates new array
startIndex - the position in the array to start setting elements
Returns:
the array with the populated collection, not null
Throws:
IndexOutOfBoundsException - if the index is negative

add

boolean add(short value)
Adds a primitive value to this collection (optional operation).

This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.

Parameters:
value - the value to add to this collection
Returns:
true if this collection was modified by this method call
Throws:
IllegalArgumentException - if value is rejected by this collection
UnsupportedOperationException - if not supported by this collection

addAll

boolean addAll(short[] values)
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.

Parameters:
values - the values to add to this collection, null treated as empty array
Returns:
true if this collection was modified by this method call
Throws:
IllegalArgumentException - if a value is rejected by this collection
UnsupportedOperationException - if not supported by this collection

addAll

boolean addAll(ShortCollection 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.

Parameters:
values - the values to add to this collection, null treated as empty collection
Returns:
true if this collection was modified by this method call
Throws:
IllegalArgumentException - if a value is rejected by this collection
UnsupportedOperationException - if not supported by this collection

addAll

boolean addAll(short startInclusive,
               short endInclusive)
Adds a range of primitive values to this collection (optional operation).

The range is defined to be inclusive of the start and end. If the start is greater than the end then the range is equivalent to an empty collection.

This method is optional, throwing an UnsupportedOperationException if the collection cannot be added to.

Parameters:
startInclusive - the inclusive range start value
endInclusive - the inclusive range end value
Returns:
true if this collection was modified by this method call
Throws:
IllegalArgumentException - if a value is rejected by this set
UnsupportedOperationException - if not supported by this set

removeFirst

boolean removeFirst(short value)
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.

Parameters:
value - the value to remove
Returns:
true if this collection was modified by this method call
Throws:
UnsupportedOperationException - if not supported by this collection

removeAll

boolean removeAll(short 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.

Parameters:
value - the value to remove
Returns:
true if this collection was modified by this method call
Throws:
UnsupportedOperationException - if not supported by this collection

removeAll

boolean removeAll(short[] values)
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.

Parameters:
values - the values to remove from this collection, null treated as empty array
Returns:
true if this collection was modified by this method call
Throws:
UnsupportedOperationException - if not supported by this collection

removeAll

boolean removeAll(ShortCollection 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.

Parameters:
values - the values to remove from this collection, null treated as empty collection
Returns:
true if this collection was modified by this method call
Throws:
UnsupportedOperationException - if not supported by this collection

removeAll

boolean removeAll(short startInclusive,
                  short endInclusive)
Removes all occurrences of a range of primitive values from this collection (optional operation).

The range is defined to be inclusive of the start and end. The elements removed are greater than or equal to the start and less than or equal to the end. Thus if the start is greater than the end then no elements are removed.

This method is optional, throwing an UnsupportedOperationException if the set cannot be changed.

Parameters:
startInclusive - the inclusive range start value
endInclusive - the inclusive range end value
Returns:
true if this collection was modified by this method call
Throws:
UnsupportedOperationException - if not supported by this collection

retainAll

boolean retainAll(short[] 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.

Parameters:
values - the values to retain in this collection, null treated as empty array
Returns:
true if this collection was modified by this method call
Throws:
UnsupportedOperationException - if not supported by this collection

retainAll

boolean retainAll(ShortCollection 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.

Parameters:
values - the values to retain in this collection, null treated as empty collection
Returns:
true if this collection was modified by this method call
Throws:
UnsupportedOperationException - if not supported by this collection

retainAll

boolean retainAll(short startInclusive,
                  short endInclusive)
Retains all occurrences of a range of primitive values within this collection removing all values outside the range (optional operation).

The range is defined to be inclusive of the start and end. If the start is greater than the end then the range is equivalent to an empty collection.

This method is optional, throwing an UnsupportedOperationException if the set cannot be changed.

Parameters:
startInclusive - the inclusive range start value
endInclusive - the inclusive range end value
Returns:
true if this collection was modified by this method call
Throws:
UnsupportedOperationException - if not supported by this collection


Copyright © 2005-2010 Joda.org. All Rights Reserved.