Package org.eclipse.jface.viewers
Interface IStructuredSelection
- All Superinterfaces:
ISelection
,Iterable
- All Known Subinterfaces:
ITreeSelection
- All Known Implementing Classes:
StructuredSelection
,TreeSelection
A selection containing elements.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the first element in this selection, ornull
if the selection is empty.iterator()
Returns an iterator over the elements of this selection.int
size()
Returns the number of elements selected in this selection.stream()
Returns the elements in this selection as aStream
.Object[]
toArray()
Returns the elements in this selection as an array.toList()
Returns the elements in this selection as aList
.Methods inherited from interface org.eclipse.jface.viewers.ISelection
isEmpty
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getFirstElement
Object getFirstElement()Returns the first element in this selection, ornull
if the selection is empty.- Returns:
- an element, or
null
if none
-
iterator
Iterator iterator()Returns an iterator over the elements of this selection. -
size
int size()Returns the number of elements selected in this selection.- Returns:
- the number of elements selected
-
toArray
Object[] toArray()Returns the elements in this selection as an array.- Returns:
- the selected elements as an array
-
toList
List toList()Returns the elements in this selection as aList
.- Returns:
- the selected elements as a list
-
stream
Returns the elements in this selection as aStream
.- Returns:
- the selected elements as a stream
- Since:
- 3.32
-