Top Description Inners Fields Constructors Methods
jdk.internal.org.objectweb.asm.tree.analysis

pack-priv final Class SmallSet<T>

extends AbstractSet<T>
Class Inheritance
Imports
java.util.AbstractSet, .HashSet, .Iterator, .NoSuchElementException, .Set

An immutable set of at most two elements, optimized for speed compared to a generic set implementation.
Author
Eric Bruneton

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final T
element1

The first element of this set, maybe null.

private final T
element2

The second element of this set, maybe null.

Constructor Summary

AccessConstructor and Description
pack-priv
SmallSet()

Constructs an empty set.

pack-priv
SmallSet(final T
the unique set element.
element
)

Constructs a set with exactly one element.

private
SmallSet(final T element1, final T element2)

Constructs a new SmallSet.

Method Summary

Modifier and TypeMethod and Description
public Iterator<T>
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).
pack-priv Set<T>

Returns:

the union of this set and of otherSet.
union
(final SmallSet<T>
another small set.
otherSet
)

Returns the union of this set and of the given set.

Inherited from java.util.AbstractSet:
equalshashCoderemoveAll

Field Detail

element1back to summary
private final T element1

The first element of this set, maybe null.

element2back to summary
private final T element2

The second element of this set, maybe null. If element1 is null then this field must be null, otherwise it must be different from element1.

Constructor Detail

SmallSetback to summary
pack-priv SmallSet()

Constructs an empty set.

SmallSetback to summary
pack-priv SmallSet(final T element)

Constructs a set with exactly one element.

Parameters
element:T

the unique set element.

SmallSetback to summary
private SmallSet(final T element1, final T element2)

Constructs a new SmallSet.

Parameters
element1:T

see element1.

element2:T

see element2.

Method Detail

iteratorback to summary
public Iterator<T> 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<T>

an iterator over the elements in this set

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.

Returns:int

the number of elements in this set (its cardinality)

Annotations
@Override
unionback to summary
pack-priv Set<T> union(final SmallSet<T> otherSet)

Returns the union of this set and of the given set.

Parameters
otherSet:SmallSet<T>

another small set.

Returns:Set<T>

the union of this set and of otherSet.

jdk.internal.org.objectweb.asm.tree.analysis back to summary

pack-priv Class SmallSet.IteratorImpl<T>

extends Object
implements Iterator<T>
Class Inheritance
  • java.lang.Object
  • jdk.internal.org.objectweb.asm.tree.analysis.SmallSet.IteratorImpl
All Implemented Interfaces
java.util.Iterator

Field Summary

Modifier and TypeField and Description
private T
firstElement

The next element to return in next.

private T
secondElement

The element to return in next, after firstElement is returned.

Constructor Summary

AccessConstructor and Description
pack-priv
IteratorImpl(final T firstElement, final T secondElement)

Method Summary

Modifier and TypeMethod and Description
public boolean
hasNext()

Implements java.util.Iterator.hasNext.

Returns true if the iteration has more elements.
public T
next()

Implements java.util.Iterator.next.

Returns the next element in the iteration.
public void
remove()

Overrides default java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation).
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

firstElementback to summary
private T firstElement

The next element to return in next. Maybe null.

secondElementback to summary
private T secondElement

The element to return in next, after firstElement is returned. If firstElement is null then this field must be null, otherwise it must be different from firstElement.

Constructor Detail

IteratorImplback to summary
pack-priv IteratorImpl(final T firstElement, final T secondElement)

Method Detail

hasNextback to summary
public boolean hasNext()

Implements java.util.Iterator.hasNext.

Doc from java.util.Iterator.hasNext.

Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)

Returns:boolean

true if the iteration has more elements

Annotations
@Override
nextback to summary
public T next()

Implements java.util.Iterator.next.

Doc from java.util.Iterator.next.

Returns the next element in the iteration.

Returns:T

the next element in the iteration

Annotations
@Override
removeback to summary
public void remove()

Overrides default java.util.Iterator.remove.

Doc from java.util.Iterator.remove.

Removes from the underlying collection the last element returned by this iterator (optional operation). This method can be called only once per call to next.

The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.

The behavior of an iterator is unspecified if this method is called after a call to the forEachRemaining method.

Annotations
@Override