com.google.common.collect.testing
Class MinimalCollection<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by com.google.common.collect.testing.MinimalCollection<E>
All Implemented Interfaces:
Iterable<E>, Collection<E>
Direct Known Subclasses:
MinimalSet

@GwtCompatible
public class MinimalCollection<E>
extends AbstractCollection<E>

A simplistic collection which implements only the bare minimum allowed by the spec, and throws exceptions whenever it can.

Author:
Kevin Bourrillion

Method Summary
 boolean addAll(Collection<? extends E> elementsToAdd)
           
 void clear()
           
 boolean contains(Object object)
           
 boolean containsAll(Collection<?> collection)
           
 Iterator<E> iterator()
           
static
<E> MinimalCollection<E>
of(E... contents)
           
static
<E> MinimalCollection<E>
ofClassAndContents(Class<? super E> type, E... contents)
           
 boolean removeAll(Collection<?> elementsToRemove)
           
 boolean retainAll(Collection<?> elementsToRetain)
           
 int size()
           
 Object[] toArray()
           
 
Methods inherited from class java.util.AbstractCollection
add, isEmpty, remove, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Method Detail

of

public static <E> MinimalCollection<E> of(E... contents)

ofClassAndContents

public static <E> MinimalCollection<E> ofClassAndContents(Class<? super E> type,
                                                          E... contents)

size

public int size()
Specified by:
size in interface Collection<E>
Specified by:
size in class AbstractCollection<E>

contains

public boolean contains(Object object)
Specified by:
contains in interface Collection<E>
Overrides:
contains in class AbstractCollection<E>

containsAll

public boolean containsAll(Collection<?> collection)
Specified by:
containsAll in interface Collection<E>
Overrides:
containsAll in class AbstractCollection<E>

iterator

public Iterator<E> iterator()
Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in class AbstractCollection<E>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<E>
Overrides:
toArray in class AbstractCollection<E>

addAll

public boolean addAll(Collection<? extends E> elementsToAdd)
Specified by:
addAll in interface Collection<E>
Overrides:
addAll in class AbstractCollection<E>

removeAll

public boolean removeAll(Collection<?> elementsToRemove)
Specified by:
removeAll in interface Collection<E>
Overrides:
removeAll in class AbstractCollection<E>

retainAll

public boolean retainAll(Collection<?> elementsToRetain)
Specified by:
retainAll in interface Collection<E>
Overrides:
retainAll in class AbstractCollection<E>

clear

public void clear()
Specified by:
clear in interface Collection<E>
Overrides:
clear in class AbstractCollection<E>


Copyright © 2010-2012. All Rights Reserved.