Top Description Fields Constructors Methods
com.thoughtworks.xstream.persistence

public Class XmlSet

extends AbstractSet
Class Inheritance
Imports
java.util.AbstractSet, .Iterator

A persistent set implementation.
Author
Guilherme Silveira

Field Summary

Modifier and TypeField and Description
private final XmlMap

Constructor Summary

AccessConstructor and Description
public
XmlSet(PersistenceStrategy persistenceStrategy)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(Object
element to be added to this set
o
)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Adds the specified element to this set if it is not already present (optional operation).
private Long
public Iterator<E>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.
public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).
Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Field Detail

mapback to summary
private final XmlMap map

Constructor Detail

XmlSetback to summary
public XmlSet(PersistenceStrategy persistenceStrategy)

Method Detail

addback to summary
public boolean add(Object o)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Doc from java.util.Set.add.

Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element e to this set if the set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throw an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the elements that they may contain.

Parameters
o:Object

element to be added to this set

Returns:boolean

true if this set did not already contain the specified element

findEmptyKeyback to summary
private Long findEmptyKey()
iteratorback to summary
public Iterator<E> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:Iterator<E>

an iterator over the elements in this set

sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)