it.unimi.dsi.fastutil.objects
Class ObjectCollections

java.lang.Object
  extended by it.unimi.dsi.fastutil.objects.ObjectCollections

public class ObjectCollections
extends Object

A class providing static methods and objects that do useful things with type-specific collections.

See Also:
Collections

Nested Class Summary
static class ObjectCollections.EmptyCollection<K>
          An immutable class representing an empty type-specific collection.
static class ObjectCollections.IterableCollection<K>
          A collection wrapper class for iterables.
static class ObjectCollections.SynchronizedCollection<K>
          A synchronized wrapper class for collections.
static class ObjectCollections.UnmodifiableCollection<K>
          An unmodifiable wrapper class for collections.
 
Method Summary
static
<K> ObjectCollection<K>
asCollection(ObjectIterable<K> iterable)
          Returns an unmodifiable collection backed by the specified iterable.
static
<K> ObjectCollection<K>
synchronize(ObjectCollection<K> c)
          Returns a synchronized collection backed by the specified collection.
static
<K> ObjectCollection<K>
synchronize(ObjectCollection<K> c, Object sync)
          Returns a synchronized collection backed by the specified collection, using an assigned object to synchronize.
static
<K> ObjectCollection<K>
unmodifiable(ObjectCollection<K> c)
          Returns an unmodifiable collection backed by the specified collection.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

synchronize

public static <K> ObjectCollection<K> synchronize(ObjectCollection<K> c)
Returns a synchronized collection backed by the specified collection.

Parameters:
c - the collection to be wrapped in a synchronized collection.
Returns:
a synchronized view of the specified collection.
See Also:
Collections.synchronizedCollection(Collection)

synchronize

public static <K> ObjectCollection<K> synchronize(ObjectCollection<K> c,
                                                  Object sync)
Returns a synchronized collection backed by the specified collection, using an assigned object to synchronize.

Parameters:
c - the collection to be wrapped in a synchronized collection.
sync - an object that will be used to synchronize the list access.
Returns:
a synchronized view of the specified collection.
See Also:
Collections.synchronizedCollection(Collection)

unmodifiable

public static <K> ObjectCollection<K> unmodifiable(ObjectCollection<K> c)
Returns an unmodifiable collection backed by the specified collection.

Parameters:
c - the collection to be wrapped in an unmodifiable collection.
Returns:
an unmodifiable view of the specified collection.
See Also:
Collections.unmodifiableCollection(Collection)

asCollection

public static <K> ObjectCollection<K> asCollection(ObjectIterable<K> iterable)
Returns an unmodifiable collection backed by the specified iterable.

Parameters:
iterable - the iterable object to be wrapped in an unmodifiable collection.
Returns:
an unmodifiable collection view of the specified iterable.