File | Line |
---|
org\joda\primitives\list\impl\AbstractBooleanList.java | 652 |
org\joda\primitives\list\impl\AbstractDoubleList.java | 652 |
dest[i + destIndex] = getShort(i + fromIndex);
}
}
/**
* Are the set methods supported.
* <p>
* This implementation returns false.
*
* @return true if supported
*/
protected boolean isSetModifiable() {
return false;
}
/**
* Is the collection modifiable in any way.
*
* @return true if supported
*/
public boolean isModifiable() {
return isAddModifiable() || isRemoveModifiable() || isSetModifiable();
}
/**
* Check whether add is suported and throw an exception.
*/
protected void checkSetModifiable() {
if (isSetModifiable() == false) {
throw new UnsupportedOperationException("Collection does not support set");
}
}
/**
* Checks whether an index is valid or not.
*
* @param index the index to check
* @throws IndexOutOfBoundsException if either index is invalid
*/
protected void checkIndexExists(int index) {
if (index < 0) {
throw new ArrayIndexOutOfBoundsException(
"Index less than zero: " + index + " < 0");
}
if (index >= size()) {
throw new ArrayIndexOutOfBoundsException(
"Index greater than/equal to size(): " + index + " >= " + size());
}
}
/**
* Checks whether an index is valid or not.
*
* @param index the index to check
* @throws IndexOutOfBoundsException if either index is invalid
*/
protected void checkIndex(int index) {
if (index < 0) {
throw new ArrayIndexOutOfBoundsException(
"Index less than zero: " + index + " < 0");
}
if (index > size()) {
throw new ArrayIndexOutOfBoundsException(
"Index greater than size(): " + index + " > " + size());
}
}
/**
* Checks whether a range is valid or not.
*
* @param fromIndexInclusive the index to start from, inclusive
* @param toIndexExclusive the index to end at, exclusive
* @throws IndexOutOfBoundsException if either index is invalid
*/
protected void checkRange(int fromIndexInclusive, int toIndexExclusive) {
if (fromIndexInclusive < 0) {
throw new ArrayIndexOutOfBoundsException(
"From index less than zero: " + fromIndexInclusive + " < 0");
}
if (toIndexExclusive > size()) {
throw new ArrayIndexOutOfBoundsException(
"To index greater than size(): " + toIndexExclusive + " > " + size());
}
if (fromIndexInclusive > toIndexExclusive) {
throw new ArrayIndexOutOfBoundsException(
"To index greater than from index: " + fromIndexInclusive + " > " + toIndexExclusive);
}
}
//-----------------------------------------------------------------------
/**
* List iterator.
*/
protected static class PListIterator implements ShortListIterator { |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractByteCollection.java | 565 |
org\joda\primitives\collection\impl\AbstractIntCollection.java | 565 |
short value = it.nextShort();
if (value < startInclusive || value > endInclusive) {
it.remove();
changed = true;
}
}
return changed;
}
// Collection integration
//-----------------------------------------------------------------------
/**
* Checks whether this collection contains a specified <code>Short</code> value.
* <p>
* This implementation uses <code>contains(short)</code>.
*
* @param value the value to search for
* @return <code>true</code> if the value is found
*/
public boolean contains(Object value) {
return contains(toPrimitive(value));
}
/**
* Checks if the collection contains all of the primitive values.
* <p>
* This implementation uses <code>containsAll(short[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if all the values are found
*/
public boolean containsAll(Collection<?> coll) {
if (coll == this || coll.size() == 0) {
return true;
}
if (size() == 0) {
return false;
}
return containsAll(toPrimitiveArray(coll));
}
/**
* Checks if the collection contains any of the primitive values in the array.
* If the specified collection is empty, <code>false</code> is returned.
* <p>
* This implementation uses <code>containsAny(short[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if at least one of the values is found
*/
public boolean containsAny(Collection<?> coll) {
if (size() == 0 || coll.size() == 0) {
return false;
}
if (coll == this) {
return true;
}
return containsAny(toPrimitiveArray(coll));
}
/**
* Gets the collection as an array of <code>Short</code>.
*
* @return an array of <code>Short</code>
*/
public Object[] toArray() {
Object[] result = new Short[size()]; |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractBooleanCollection.java | 427 |
org\joda\primitives\collection\impl\AbstractFloatCollection.java | 427 |
if (values.contains(it.nextFloat()) == false) {
it.remove();
changed = true;
}
}
}
return changed;
}
// Collection integration
//-----------------------------------------------------------------------
/**
* Checks whether this collection contains a specified <code>Float</code> value.
* <p>
* This implementation uses <code>contains(float)</code>.
*
* @param value the value to search for
* @return <code>true</code> if the value is found
*/
public boolean contains(Object value) {
return contains(toPrimitive(value));
}
/**
* Checks if the collection contains all of the primitive values.
* <p>
* This implementation uses <code>containsAll(float[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if all the values are found
*/
public boolean containsAll(Collection<?> coll) {
if (coll == this || coll.size() == 0) {
return true;
}
if (size() == 0) {
return false;
}
return containsAll(toPrimitiveArray(coll));
}
/**
* Checks if the collection contains any of the primitive values in the array.
* If the specified collection is empty, <code>false</code> is returned.
* <p>
* This implementation uses <code>containsAny(float[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if at least one of the values is found
*/
public boolean containsAny(Collection<?> coll) {
if (size() == 0 || coll.size() == 0) {
return false;
}
if (coll == this) {
return true;
}
return containsAny(toPrimitiveArray(coll));
}
/**
* Gets the collection as an array of <code>Float</code>.
*
* @return an array of <code>Float</code>
*/
public Object[] toArray() {
Object[] result = new Float[size()]; |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractFloatCollection.java | 559 |
org\joda\primitives\collection\impl\AbstractLongCollection.java | 697 |
public boolean addAll(Collection<? extends Short> coll) {
checkAddModifiable();
return addAll(toPrimitiveArray(coll));
}
/**
* Removes the first occurrance of the specified <code>Short</code> value from
* this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be removed from.
* <p>
* This implementation uses <code>removeFirst(short)</code>.
*
* @param value the value to remove
* @return <code>true</code> if this collection was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean remove(Object value) {
checkRemoveModifiable();
return removeFirst(toPrimitive(value));
}
/**
* Removes each of a collection of <code>Short</code> values from this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>removeAll(short[])</code>.
*
* @param coll the values to remove from this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean removeAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
int size = size();
clear();
return (size() != size);
}
return removeAll(toPrimitiveArray(coll));
}
/**
* Retains each of a collection of <code>Short</code> values, removing other
* values (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>retainAll(short[])</code>.
*
* @param coll the values to retain in this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean retainAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
return false;
}
return retainAll(toPrimitiveArray(coll));
}
// Basics
//-----------------------------------------------------------------------
/**
* Gets a string representing this collection.
* <p>
* The format used is as per <code>Collection</code>.
*
* @return collection as a String
*/
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("["); |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractFloatCollection.java | 431 |
org\joda\primitives\collection\impl\AbstractShortCollection.java | 569 |
}
}
return changed;
}
// Collection integration
//-----------------------------------------------------------------------
/**
* Checks whether this collection contains a specified <code>Integer</code> value.
* <p>
* This implementation uses <code>contains(int)</code>.
*
* @param value the value to search for
* @return <code>true</code> if the value is found
*/
public boolean contains(Object value) {
return contains(toPrimitive(value));
}
/**
* Checks if the collection contains all of the primitive values.
* <p>
* This implementation uses <code>containsAll(int[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if all the values are found
*/
public boolean containsAll(Collection<?> coll) {
if (coll == this || coll.size() == 0) {
return true;
}
if (size() == 0) {
return false;
}
return containsAll(toPrimitiveArray(coll));
}
/**
* Checks if the collection contains any of the primitive values in the array.
* If the specified collection is empty, <code>false</code> is returned.
* <p>
* This implementation uses <code>containsAny(int[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if at least one of the values is found
*/
public boolean containsAny(Collection<?> coll) {
if (size() == 0 || coll.size() == 0) {
return false;
}
if (coll == this) {
return true;
}
return containsAny(toPrimitiveArray(coll));
}
/**
* Gets the collection as an array of <code>Integer</code>.
*
* @return an array of <code>Integer</code>
*/
public Object[] toArray() {
Object[] result = new Integer[size()]; |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractDoubleCollection.java | 559 |
org\joda\primitives\collection\impl\AbstractLongCollection.java | 697 |
public boolean addAll(Collection<? extends Float> coll) {
checkAddModifiable();
return addAll(toPrimitiveArray(coll));
}
/**
* Removes the first occurrance of the specified <code>Float</code> value from
* this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be removed from.
* <p>
* This implementation uses <code>removeFirst(float)</code>.
*
* @param value the value to remove
* @return <code>true</code> if this collection was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean remove(Object value) {
checkRemoveModifiable();
return removeFirst(toPrimitive(value));
}
/**
* Removes each of a collection of <code>Float</code> values from this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>removeAll(float[])</code>.
*
* @param coll the values to remove from this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean removeAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
int size = size();
clear();
return (size() != size);
}
return removeAll(toPrimitiveArray(coll));
}
/**
* Retains each of a collection of <code>Float</code> values, removing other
* values (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>retainAll(float[])</code>.
*
* @param coll the values to retain in this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean retainAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
return false;
}
return retainAll(toPrimitiveArray(coll));
}
// Basics
//-----------------------------------------------------------------------
/**
* Gets a string representing this collection.
* <p>
* The format used is as per <code>Collection</code>.
*
* @return collection as a String
*/
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("["); |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractDoubleCollection.java | 431 |
org\joda\primitives\collection\impl\AbstractLongCollection.java | 569 |
}
}
return changed;
}
// Collection integration
//-----------------------------------------------------------------------
/**
* Checks whether this collection contains a specified <code>Integer</code> value.
* <p>
* This implementation uses <code>contains(int)</code>.
*
* @param value the value to search for
* @return <code>true</code> if the value is found
*/
public boolean contains(Object value) {
return contains(toPrimitive(value));
}
/**
* Checks if the collection contains all of the primitive values.
* <p>
* This implementation uses <code>containsAll(int[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if all the values are found
*/
public boolean containsAll(Collection<?> coll) {
if (coll == this || coll.size() == 0) {
return true;
}
if (size() == 0) {
return false;
}
return containsAll(toPrimitiveArray(coll));
}
/**
* Checks if the collection contains any of the primitive values in the array.
* If the specified collection is empty, <code>false</code> is returned.
* <p>
* This implementation uses <code>containsAny(int[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if at least one of the values is found
*/
public boolean containsAny(Collection<?> coll) {
if (size() == 0 || coll.size() == 0) {
return false;
}
if (coll == this) {
return true;
}
return containsAny(toPrimitiveArray(coll));
}
/**
* Gets the collection as an array of <code>Integer</code>.
*
* @return an array of <code>Integer</code>
*/
public Object[] toArray() {
Object[] result = new Integer[size()]; |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractCharCollection.java | 697 |
org\joda\primitives\collection\impl\AbstractDoubleCollection.java | 559 |
public boolean addAll(Collection<? extends Double> coll) {
checkAddModifiable();
return addAll(toPrimitiveArray(coll));
}
/**
* Removes the first occurrance of the specified <code>Double</code> value from
* this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be removed from.
* <p>
* This implementation uses <code>removeFirst(double)</code>.
*
* @param value the value to remove
* @return <code>true</code> if this collection was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean remove(Object value) {
checkRemoveModifiable();
return removeFirst(toPrimitive(value));
}
/**
* Removes each of a collection of <code>Double</code> values from this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>removeAll(double[])</code>.
*
* @param coll the values to remove from this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean removeAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
int size = size();
clear();
return (size() != size);
}
return removeAll(toPrimitiveArray(coll));
}
/**
* Retains each of a collection of <code>Double</code> values, removing other
* values (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>retainAll(double[])</code>.
*
* @param coll the values to retain in this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean retainAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
return false;
}
return retainAll(toPrimitiveArray(coll));
}
// Basics
//-----------------------------------------------------------------------
/**
* Gets a string representing this collection.
* <p>
* The format used is as per <code>Collection</code>.
*
* @return collection as a String
*/
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("["); |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractCharCollection.java | 569 |
org\joda\primitives\collection\impl\AbstractDoubleCollection.java | 431 |
}
}
return changed;
}
// Collection integration
//-----------------------------------------------------------------------
/**
* Checks whether this collection contains a specified <code>Double</code> value.
* <p>
* This implementation uses <code>contains(double)</code>.
*
* @param value the value to search for
* @return <code>true</code> if the value is found
*/
public boolean contains(Object value) {
return contains(toPrimitive(value));
}
/**
* Checks if the collection contains all of the primitive values.
* <p>
* This implementation uses <code>containsAll(double[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if all the values are found
*/
public boolean containsAll(Collection<?> coll) {
if (coll == this || coll.size() == 0) {
return true;
}
if (size() == 0) {
return false;
}
return containsAll(toPrimitiveArray(coll));
}
/**
* Checks if the collection contains any of the primitive values in the array.
* If the specified collection is empty, <code>false</code> is returned.
* <p>
* This implementation uses <code>containsAny(double[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if at least one of the values is found
*/
public boolean containsAny(Collection<?> coll) {
if (size() == 0 || coll.size() == 0) {
return false;
}
if (coll == this) {
return true;
}
return containsAny(toPrimitiveArray(coll));
}
/**
* Gets the collection as an array of <code>Double</code>.
*
* @return an array of <code>Double</code>
*/
public Object[] toArray() {
Object[] result = new Double[size()]; |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractByteCollection.java | 697 |
org\joda\primitives\collection\impl\AbstractShortCollection.java | 697 |
public boolean addAll(Collection<? extends Character> coll) {
checkAddModifiable();
return addAll(toPrimitiveArray(coll));
}
/**
* Removes the first occurrance of the specified <code>Character</code> value from
* this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be removed from.
* <p>
* This implementation uses <code>removeFirst(char)</code>.
*
* @param value the value to remove
* @return <code>true</code> if this collection was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean remove(Object value) {
checkRemoveModifiable();
return removeFirst(toPrimitive(value));
}
/**
* Removes each of a collection of <code>Character</code> values from this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>removeAll(char[])</code>.
*
* @param coll the values to remove from this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean removeAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
int size = size();
clear();
return (size() != size);
}
return removeAll(toPrimitiveArray(coll));
}
/**
* Retains each of a collection of <code>Character</code> values, removing other
* values (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>retainAll(char[])</code>.
*
* @param coll the values to retain in this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean retainAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
return false;
}
return retainAll(toPrimitiveArray(coll));
}
// Basics
//-----------------------------------------------------------------------
/**
* Gets a string representing this collection.
* <p>
* The format used is as per <code>Collection</code>.
*
* @return collection as a String
*/
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("["); |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractByteCollection.java | 569 |
org\joda\primitives\collection\impl\AbstractDoubleCollection.java | 431 |
}
}
return changed;
}
// Collection integration
//-----------------------------------------------------------------------
/**
* Checks whether this collection contains a specified <code>Double</code> value.
* <p>
* This implementation uses <code>contains(double)</code>.
*
* @param value the value to search for
* @return <code>true</code> if the value is found
*/
public boolean contains(Object value) {
return contains(toPrimitive(value));
}
/**
* Checks if the collection contains all of the primitive values.
* <p>
* This implementation uses <code>containsAll(double[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if all the values are found
*/
public boolean containsAll(Collection<?> coll) {
if (coll == this || coll.size() == 0) {
return true;
}
if (size() == 0) {
return false;
}
return containsAll(toPrimitiveArray(coll));
}
/**
* Checks if the collection contains any of the primitive values in the array.
* If the specified collection is empty, <code>false</code> is returned.
* <p>
* This implementation uses <code>containsAny(double[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if at least one of the values is found
*/
public boolean containsAny(Collection<?> coll) {
if (size() == 0 || coll.size() == 0) {
return false;
}
if (coll == this) {
return true;
}
return containsAny(toPrimitiveArray(coll));
}
/**
* Gets the collection as an array of <code>Double</code>.
*
* @return an array of <code>Double</code>
*/
public Object[] toArray() {
Object[] result = new Double[size()]; |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractBooleanCollection.java | 559 |
org\joda\primitives\collection\impl\AbstractLongCollection.java | 697 |
public boolean addAll(Collection<? extends Byte> coll) {
checkAddModifiable();
return addAll(toPrimitiveArray(coll));
}
/**
* Removes the first occurrance of the specified <code>Byte</code> value from
* this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be removed from.
* <p>
* This implementation uses <code>removeFirst(byte)</code>.
*
* @param value the value to remove
* @return <code>true</code> if this collection was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean remove(Object value) {
checkRemoveModifiable();
return removeFirst(toPrimitive(value));
}
/**
* Removes each of a collection of <code>Byte</code> values from this collection (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>removeAll(byte[])</code>.
*
* @param coll the values to remove from this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean removeAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
int size = size();
clear();
return (size() != size);
}
return removeAll(toPrimitiveArray(coll));
}
/**
* Retains each of a collection of <code>Byte</code> values, removing other
* values (optional operation).
* <p>
* This method is optional, throwing an UnsupportedOperationException if the
* collection cannot be added to.
* <p>
* This implementation uses <code>retainAll(byte[])</code>.
*
* @param coll the values to retain in this collection
* @return <code>true</code> if this list was modified by this method call
* @throws UnsupportedOperationException if not supported by this collection
*/
public boolean retainAll(Collection<?> coll) {
checkRemoveModifiable();
if (coll == this) {
return false;
}
return retainAll(toPrimitiveArray(coll));
}
// Basics
//-----------------------------------------------------------------------
/**
* Gets a string representing this collection.
* <p>
* The format used is as per <code>Collection</code>.
*
* @return collection as a String
*/
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("["); |
File | Line |
---|
org\joda\primitives\collection\impl\AbstractBooleanCollection.java | 431 |
org\joda\primitives\collection\impl\AbstractCharCollection.java | 569 |
}
}
return changed;
}
// Collection integration
//-----------------------------------------------------------------------
/**
* Checks whether this collection contains a specified <code>Byte</code> value.
* <p>
* This implementation uses <code>contains(byte)</code>.
*
* @param value the value to search for
* @return <code>true</code> if the value is found
*/
public boolean contains(Object value) {
return contains(toPrimitive(value));
}
/**
* Checks if the collection contains all of the primitive values.
* <p>
* This implementation uses <code>containsAll(byte[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if all the values are found
*/
public boolean containsAll(Collection<?> coll) {
if (coll == this || coll.size() == 0) {
return true;
}
if (size() == 0) {
return false;
}
return containsAll(toPrimitiveArray(coll));
}
/**
* Checks if the collection contains any of the primitive values in the array.
* If the specified collection is empty, <code>false</code> is returned.
* <p>
* This implementation uses <code>containsAny(byte[])</code>.
*
* @param coll the collection of values to search for
* @return <code>true</code> if at least one of the values is found
*/
public boolean containsAny(Collection<?> coll) {
if (size() == 0 || coll.size() == 0) {
return false;
}
if (coll == this) {
return true;
}
return containsAny(toPrimitiveArray(coll));
}
/**
* Gets the collection as an array of <code>Byte</code>.
*
* @return an array of <code>Byte</code>
*/
public Object[] toArray() {
Object[] result = new Byte[size()]; |
File | Line |
---|
org\joda\primitives\collection\impl\ArrayBooleanCollection.java | 307 |
org\joda\primitives\collection\impl\ArrayCharCollection.java | 333 |
protected boolean doAdd(int index, short[] values) {
int len = values.length;
ensureCapacity(size + len);
System.arraycopy(values, 0, data, size, len);
size += len;
return (len > 0);
}
/**
* Internal implementation to remove the element at the specified index.
*
* @param index the index, valid
*/
protected void doRemoveIndex(int index) {
System.arraycopy(data, index + 1, data, index, size - 1 - index);
size--;
}
/**
* Internal implementation to ensure that the internal storage array has
* at least the specified size.
*
* @param reqCapacity the amount to expand to
*/
protected void ensureCapacity(int reqCapacity) {
int curCapacity = data.length;
if (reqCapacity <= curCapacity) {
return;
}
int newCapacity = curCapacity * GROWTH_FACTOR_MULTIPLIER / GROWTH_FACTOR_DIVISOR;
if ((newCapacity - curCapacity) < MIN_GROWTH_SIZE) {
newCapacity = curCapacity + MIN_GROWTH_SIZE;
}
if (newCapacity < reqCapacity) {
newCapacity = reqCapacity;
} |
File | Line |
---|
org\joda\primitives\list\impl\ArrayBooleanList.java | 252 |
org\joda\primitives\list\impl\ArrayShortList.java | 252 |
public boolean addAll(int index, short[] values) {
checkAddModifiable();
checkIndex(index);
if (values == null || values.length == 0) {
return false;
}
int len = values.length;
ensureCapacity(size + len);
System.arraycopy(data, index, data, index + len, size - index);
System.arraycopy(values, 0, data, index, len);
size += len;
return true;
}
//-----------------------------------------------------------------------
/**
* Are the add methods supported.
*
* @return <code>true</code>
*/
protected boolean isAddModifiable() {
return true;
}
/**
* Are the remove methods supported.
*
* @return <code>true</code>
*/
protected boolean isRemoveModifiable() {
return true;
}
/**
* Are the remove methods supported.
*
* @return <code>true</code>
*/
protected boolean isSetModifiable() {
return true;
}
/**
* Checks whether the object can currently be modified.
*
* @return <code>true</code>
*/
public boolean isModifiable() {
return true;
}
/**
* Clone implementation that calls Object clone().
*
* @return the clone
*/
public Object clone() { |