|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.didion.jwnl.util.TypeCheckingList
public class TypeCheckingList
Wrapper for a list that checks the type of arguments before putting them in the list. It also does type-checking on methods which iterate over the list so that they fail fast if the argument is not of the correct type.
| Nested Class Summary | |
|---|---|
class |
TypeCheckingList.TypeCheckingListIterator
|
| Constructor Summary | |
|---|---|
|
TypeCheckingList(Class type)
|
|
TypeCheckingList(List backingList,
Class type)
|
protected |
TypeCheckingList(List backingList,
Class type,
Class parentType)
Create a new Type checking list that checks for type type, but only if parentType is equal to, a super class/interface of, or an interface implemented by type. |
| Method Summary | |
|---|---|
void |
add(int index,
Object o)
|
boolean |
add(Object o)
|
boolean |
addAll(Collection c)
|
boolean |
addAll(int index,
Collection c)
|
void |
clear()
|
Object |
clone()
Create a shallow clone of the object |
boolean |
contains(Object o)
|
boolean |
containsAll(Collection c)
|
protected List |
copyBackingList()
Make a copy of the wrapped list - used by subclasses when the overriding the clone method |
Object |
deepClone()
Create a deep clone of the object |
boolean |
equals(Object obj)
|
Object |
get(int index)
|
Class |
getType()
|
protected TypeCheckingList.TypeCheckingListIterator |
getTypeCheckingListIterator()
|
protected TypeCheckingList.TypeCheckingListIterator |
getTypeCheckingListIterator(int index)
|
int |
indexOf(Object o)
|
boolean |
isEmpty()
|
Iterator |
iterator()
|
int |
lastIndexOf(Object o)
|
ListIterator |
listIterator()
|
ListIterator |
listIterator(int index)
|
Object |
remove(int index)
|
boolean |
remove(Object o)
|
boolean |
removeAll(Collection c)
|
boolean |
retainAll(Collection c)
|
Object |
set(int index,
Object element)
|
int |
size()
|
List |
subList(int fromIndex,
int toIndex)
|
Object[] |
toArray()
|
Object[] |
toArray(Object[] a)
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.List |
|---|
hashCode |
| Constructor Detail |
|---|
public TypeCheckingList(Class type)
public TypeCheckingList(List backingList,
Class type)
protected TypeCheckingList(List backingList,
Class type,
Class parentType)
| Method Detail |
|---|
public Class getType()
public Object clone()
throws CloneNotSupportedException
DeepCloneable
clone in interface DeepCloneableclone in class ObjectCloneNotSupportedException
protected List copyBackingList()
throws CloneNotSupportedException
CloneNotSupportedException
public Object deepClone()
throws UnsupportedOperationException
DeepCloneable
deepClone in interface DeepCloneableUnsupportedOperationExceptionpublic boolean equals(Object obj)
equals in interface Collectionequals in interface Listequals in class Objectpublic boolean add(Object o)
add in interface Collectionadd in interface List
public void add(int index,
Object o)
add in interface Listpublic boolean addAll(Collection c)
addAll in interface CollectionaddAll in interface List
public boolean addAll(int index,
Collection c)
addAll in interface Listpublic boolean contains(Object o)
contains in interface Collectioncontains in interface Listpublic boolean containsAll(Collection c)
containsAll in interface CollectioncontainsAll in interface List
public Object set(int index,
Object element)
set in interface Listpublic int indexOf(Object o)
indexOf in interface Listpublic int lastIndexOf(Object o)
lastIndexOf in interface Listpublic boolean remove(Object o)
remove in interface Collectionremove in interface Listpublic ListIterator listIterator()
listIterator in interface Listpublic ListIterator listIterator(int index)
listIterator in interface Listprotected TypeCheckingList.TypeCheckingListIterator getTypeCheckingListIterator()
protected TypeCheckingList.TypeCheckingListIterator getTypeCheckingListIterator(int index)
public int size()
size in interface Collectionsize in interface Listpublic boolean isEmpty()
isEmpty in interface CollectionisEmpty in interface Listpublic Iterator iterator()
iterator in interface Iterableiterator in interface Collectioniterator in interface Listpublic Object[] toArray()
toArray in interface CollectiontoArray in interface Listpublic Object[] toArray(Object[] a)
toArray in interface CollectiontoArray in interface Listpublic boolean removeAll(Collection c)
removeAll in interface CollectionremoveAll in interface Listpublic boolean retainAll(Collection c)
retainAll in interface CollectionretainAll in interface Listpublic void clear()
clear in interface Collectionclear in interface Listpublic Object get(int index)
get in interface Listpublic Object remove(int index)
remove in interface List
public List subList(int fromIndex,
int toIndex)
subList in interface List
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||