Package org.apache.pivot.collections
Interface Sequence<T>
-
- Type Parameters:
T
- The type of elements stored in this sequence.
- All Known Subinterfaces:
List<T>
- All Known Implementing Classes:
Accordion
,Accordion.PanelSequence
,AccordionHeaderDataRenderer
,Alert
,Alert.OptionSequence
,ArrayAdapter
,ArrayList
,Block
,Border
,BoxPane
,BulletedList
,ButtonDataRenderer
,Calendar
,CalendarButtonDataRenderer
,CalendarDateSpinnerData
,CardPane
,ChartView.CategorySequence
,ColorChooser
,ColorChooserButtonSkin.ColorChooserPopup
,Component.DecoratorSequence
,Container
,Dialog
,Display
,Document
,Element
,Element
,Element.AttributeSequence
,EnumList
,Expander
,FileBrowser
,FileBrowserSheet
,FileList
,FileObjectList
,FillPane
,FlowPane
,Form
,Form.Section
,Form.SectionSequence
,Frame
,GridPane
,GridPane.Row
,GridPane.RowSequence
,HistogramSeries
,ImmutableList
,LinkButtonDataRenderer
,LinkedList
,List
,List.Item
,ListAdapter
,ListButtonDataRenderer
,ListViewColorItemRenderer
,ListViewItemEditor
,ListViewItemRenderer
,Menu
,Menu.Section
,Menu.SectionSequence
,MenuBar
,MenuBar.ItemSequence
,MenuBarItemDataRenderer
,MenuButtonDataRenderer
,MenuItemDataRenderer
,MenuPopup
,NumberedList
,NumericSpinnerData
,Palette
,Panel
,Panorama
,Paragraph
,Prompt
,Prompt.OptionSequence
,QueryServlet.Path
,ReadOnlySequence
,ResultList
,Rollup
,ScrollBar
,ScrollPane
,Sequence.Tree.ImmutablePath
,Sequence.Tree.Path
,Sheet
,Slider
,Spinner
,SplitPane
,StackPane
,SuggestionPopup
,SynchronizedList
,TablePane
,TablePane.ColumnSequence
,TablePane.Row
,TablePane.RowSequence
,TableView.ColumnSequence
,TableViewBooleanCellRenderer
,TableViewCheckboxCellRenderer
,TableViewHeaderDataRenderer
,TableViewRowEditor
,TableViewTriStateCellRenderer
,TabPane
,TabPane.TabSequence
,TaskSequence
,TerraFileBrowserSkin.DriveRenderer
,TerraFileBrowserSkin.FileRenderer
,TerraFileBrowserSkin.ListButtonDriveRenderer
,TerraFileBrowserSkin.ListButtonFileRenderer
,TerraFileBrowserSkin.ListViewDriveRenderer
,TerraFileBrowserSkin.ListViewFileRenderer
,TerraFileBrowserSkin.TableViewFileRenderer
,TerraVFSBrowserSkin.DriveRenderer
,TerraVFSBrowserSkin.FileRenderer
,TerraVFSBrowserSkin.ListButtonDriveRenderer
,TerraVFSBrowserSkin.ListButtonFileRenderer
,TerraVFSBrowserSkin.ListViewDriveRenderer
,TerraVFSBrowserSkin.ListViewFileRenderer
,TerraVFSBrowserSkin.TableViewFileRenderer
,TextArea.ParagraphSequence
,TextPane
,TextSpan
,Tooltip
,TreeBranch
,TreeViewNodeEditor
,TreeViewNodeRenderer
,ValueSeries
,VerticalButtonDataRenderer
,VFSBrowser
,VFSBrowserSheet
,Viewport
,Window
,Window.ActionMappingSequence
,Window.IconImageSequence
public interface Sequence<T>
Interface representing an ordered sequence of items.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Sequence.Tree<T>
Collection of static utility methods providing path access to nested sequence data.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
add(T item)
Adds an item to the sequence.default void
addAll(Collection<T> c)
Add all the elements of the given collection to this sequence using theadd(T)
method of this interface.default void
addAll(T[] array)
Add all the elements of the given array to this sequence using theadd(T)
method of this interface.T
get(int index)
Retrieves the item at the given index.int
getLength()
Returns the length of the sequence.int
indexOf(T item)
Returns the index of an item in the sequence.void
insert(T item, int index)
Inserts an item into the sequence at a specific index.Sequence<T>
remove(int index, int count)
Removes one or more items from the sequence.int
remove(T item)
Removes the first occurrence of the given item from the sequence.T
update(int index, T item)
Updates the item at the given index.
-
-
-
Method Detail
-
add
int add(T item)
Adds an item to the sequence.- Parameters:
item
- The item to be added to the sequence.- Returns:
- The index at which the item was added, or
-1
if the item was not added to the sequence.
-
insert
void insert(T item, int index)
Inserts an item into the sequence at a specific index.- Parameters:
item
- The item to be added to the sequence.index
- The index at which the item should be inserted. Must be a value between0
andgetLength()
.
-
update
T update(int index, T item)
Updates the item at the given index.- Parameters:
index
- The index of the item to update.item
- The item that will replace any existing value at the given index.- Returns:
- The item that was previously stored at the given index.
-
remove
int remove(T item)
Removes the first occurrence of the given item from the sequence.- Parameters:
item
- The item to remove.- Returns:
- The index of the item that was removed, or
-1
if the item could not be found. - See Also:
remove(int, int)
-
remove
Sequence<T> remove(int index, int count)
Removes one or more items from the sequence.- Parameters:
index
- The starting index to remove.count
- The number of items to remove, beginning withindex
.- Returns:
- A sequence containing the items that were removed.
-
get
T get(int index)
Retrieves the item at the given index.- Parameters:
index
- The index of the item to retrieve.- Returns:
- The item at this index in the sequence.
-
indexOf
int indexOf(T item)
Returns the index of an item in the sequence.- Parameters:
item
- The item to locate.- Returns:
- The index of first occurrence of the item if it exists in the
sequence;
-1
, otherwise.
-
getLength
int getLength()
Returns the length of the sequence.- Returns:
- The number of items in the sequence.
-
addAll
default void addAll(Collection<T> c)
Add all the elements of the given collection to this sequence using theadd(T)
method of this interface.- Parameters:
c
- The other collection to add to this sequence.
-
-