APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.javafx.collections

public final Class UnmodifiableListSet<E>

extends AbstractSet<E>
Class Inheritance
Imports
java.util.AbstractSet, .Iterator, .List

A special unmodifiable implementation of Set which wraps a List. It does not check for uniqueness! There are several places in our implementation (Node.lookupAll and ObservableSetWrapper are two such places) where we want to use a List for speed of insertion and will be in a position to ensure that the List is unique without having the overhead of hashing, but want to present an unmodifiable Set in the public API.

Field Summary

Modifier and TypeField and Description
private List<E>

Constructor Summary

AccessConstructor and Description
public
UnmodifiableListSet(List<E> backingList)

Method Summary

Modifier and TypeMethod and Description
public Iterator<E>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

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

Required implementation that returns an iterator.

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

backingListback to summary
private List<E> backingList

Constructor Detail

UnmodifiableListSetback to summary
public UnmodifiableListSet(List<E> backingList)

Method Detail

iteratorback to summary
public Iterator<E> iterator()

Implements abstract java.util.AbstractCollection.iterator.

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

Required implementation that returns an iterator. Note that I don't just return backingList.iterator() because doing so would open up a whole through which developers could remove items from this supposedly unmodifiable set. So the iterator is wrapped such that it throws an exception on remove.

Annotations
@Override
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.

Annotations
@Override