it.unimi.dsi.fastutil.bytes
Class ByteCollections.SynchronizedCollection

java.lang.Object
  extended by it.unimi.dsi.fastutil.bytes.ByteCollections.SynchronizedCollection
All Implemented Interfaces:
ByteCollection, ByteIterable, java.io.Serializable, java.lang.Iterable<java.lang.Byte>, java.util.Collection<java.lang.Byte>
Direct Known Subclasses:
ByteBigLists.SynchronizedBigList, ByteLists.SynchronizedList, ByteSets.SynchronizedSet
Enclosing class:
ByteCollections

public static class ByteCollections.SynchronizedCollection
extends java.lang.Object
implements ByteCollection, java.io.Serializable

A synchronized wrapper class for collections.

See Also:
Serialized Form

Method Summary
 boolean add(byte k)
           
 boolean add(java.lang.Byte k)
           
 boolean addAll(ByteCollection c)
           
 boolean addAll(java.util.Collection<? extends java.lang.Byte> c)
           
 ByteIterator byteIterator()
          Deprecated. 
 void clear()
           
 boolean contains(byte o)
           
 boolean contains(java.lang.Object k)
           
 boolean containsAll(ByteCollection c)
           
 boolean containsAll(java.util.Collection<?> c)
           
 boolean isEmpty()
           
 ByteIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 boolean rem(byte k)
          Note that this method should be called remove(), but the clash with the similarly named index-based method in the List interface forces us to use a distinguished name.
 boolean remove(java.lang.Object ok)
           
 boolean removeAll(ByteCollection c)
           
 boolean removeAll(java.util.Collection<?> c)
           
 boolean retainAll(ByteCollection c)
           
 boolean retainAll(java.util.Collection<?> c)
           
 int size()
           
 java.lang.Object[] toArray()
           
 byte[] toArray(byte[] a)
          Returns a primitive type array containing the items of this collection.
<T> T[]
toArray(T[] a)
          Returns an containing the items of this collection; the runtime type of the returned array is that of the specified array.
 byte[] toByteArray()
          Returns a primitive type array containing the items of this collection.
 byte[] toByteArray(byte[] a)
          Returns a primitive type array containing the items of this collection.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Method Detail

size

public int size()
Specified by:
size in interface java.util.Collection<java.lang.Byte>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<java.lang.Byte>

contains

public boolean contains(byte o)
Specified by:
contains in interface ByteCollection
See Also:
Collection.contains(Object)

toByteArray

public byte[] toByteArray()
Description copied from interface: ByteCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toByteArray in interface ByteCollection
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<java.lang.Byte>

toByteArray

public byte[] toByteArray(byte[] a)
Description copied from interface: ByteCollection
Returns a primitive type array containing the items of this collection.

Note that, contrarily to Collection.toArray(Object[]), this methods just writes all elements of this collection: no special value will be added after the last one.

Specified by:
toByteArray in interface ByteCollection
Parameters:
a - if this array is big enough, it will be used to store this collection.
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray(Object[])

toArray

public byte[] toArray(byte[] a)
Description copied from interface: ByteCollection
Returns a primitive type array containing the items of this collection.

Note that, contrarily to Collection.toArray(Object[]), this methods just writes all elements of this collection: no special value will be added after the last one.

Specified by:
toArray in interface ByteCollection
Parameters:
a - if this array is big enough, it will be used to store this collection.
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray(Object[])

addAll

public boolean addAll(ByteCollection c)
Specified by:
addAll in interface ByteCollection
See Also:
Collection.addAll(Collection)

containsAll

public boolean containsAll(ByteCollection c)
Specified by:
containsAll in interface ByteCollection
See Also:
Collection.containsAll(Collection)

removeAll

public boolean removeAll(ByteCollection c)
Specified by:
removeAll in interface ByteCollection
See Also:
Collection.removeAll(Collection)

retainAll

public boolean retainAll(ByteCollection c)
Specified by:
retainAll in interface ByteCollection
See Also:
Collection.retainAll(Collection)

add

public boolean add(java.lang.Byte k)
Specified by:
add in interface java.util.Collection<java.lang.Byte>

contains

public boolean contains(java.lang.Object k)
Specified by:
contains in interface java.util.Collection<java.lang.Byte>

toArray

public <T> T[] toArray(T[] a)
Description copied from interface: ByteCollection
Returns an containing the items of this collection; the runtime type of the returned array is that of the specified array.

Warning: Note that, contrarily to Collection.toArray(Object[]), this methods just writes all elements of this collection: no special value will be added after the last one.

Specified by:
toArray in interface ByteCollection
Specified by:
toArray in interface java.util.Collection<java.lang.Byte>
Parameters:
a - if this array is big enough, it will be used to store this collection.
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray(Object[])

iterator

public ByteIterator iterator()
Description copied from interface: ByteCollection
Returns a type-specific iterator on the elements of this collection.

Note that this specification strengthens the one given in Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extends Collection.

Specified by:
iterator in interface ByteCollection
Specified by:
iterator in interface ByteIterable
Specified by:
iterator in interface java.lang.Iterable<java.lang.Byte>
Specified by:
iterator in interface java.util.Collection<java.lang.Byte>
Returns:
a type-specific iterator on the elements of this collection.

byteIterator

@Deprecated
public ByteIterator byteIterator()
Deprecated. 

Description copied from interface: ByteCollection
Returns a type-specific iterator on this elements of this collection.

Specified by:
byteIterator in interface ByteCollection
See Also:
ByteCollection.iterator()

add

public boolean add(byte k)
Specified by:
add in interface ByteCollection
See Also:
Collection.add(Object)

rem

public boolean rem(byte k)
Description copied from interface: ByteCollection
Note that this method should be called remove(), but the clash with the similarly named index-based method in the List interface forces us to use a distinguished name. For simplicity, the set interfaces reinstates remove().

Specified by:
rem in interface ByteCollection
See Also:
Collection.remove(Object)

remove

public boolean remove(java.lang.Object ok)
Specified by:
remove in interface java.util.Collection<java.lang.Byte>

addAll

public boolean addAll(java.util.Collection<? extends java.lang.Byte> c)
Specified by:
addAll in interface java.util.Collection<java.lang.Byte>

containsAll

public boolean containsAll(java.util.Collection<?> c)
Specified by:
containsAll in interface java.util.Collection<java.lang.Byte>

removeAll

public boolean removeAll(java.util.Collection<?> c)
Specified by:
removeAll in interface java.util.Collection<java.lang.Byte>

retainAll

public boolean retainAll(java.util.Collection<?> c)
Specified by:
retainAll in interface java.util.Collection<java.lang.Byte>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<java.lang.Byte>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object