Package sleep.engine.types
Class ListContainer
- java.lang.Object
-
- sleep.engine.types.ListContainer
-
- All Implemented Interfaces:
java.io.Serializable,ScalarArray
public class ListContainer extends java.lang.Object implements ScalarArray
A linked list backing for Sleep Arrays. Most array ops are better off with this type of backing- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Listvalues
-
Constructor Summary
Constructors Constructor Description ListContainer()ListContainer(java.util.Collection initialValues)initial values must be a collection of Scalar'sListContainer(java.util.List list)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Scalaradd(Scalar value, int index)add an element to the array at the specified indexScalargetAt(int index)get an element at the specified indexScalarpop()remove the topmost element from the arrayScalarpush(Scalar value)add an element onto the end of the arrayScalarremove(int index)remove an element at the specified indexvoidremove(Scalar key)remove all elements with the same identity as the specified scalarjava.util.IteratorscalarIterator()return an iteratorintsize()return the size of the arrayvoidsort(java.util.Comparator compare)sort this array with the specified comparatorScalarArraysublist(int from, int to)return a view into the array, ideally one that uses the same backing storejava.lang.StringtoString()
-
-
-
Method Detail
-
sublist
public ScalarArray sublist(int from, int to)
Description copied from interface:ScalarArrayreturn a view into the array, ideally one that uses the same backing store- Specified by:
sublistin interfaceScalarArray
-
pop
public Scalar pop()
Description copied from interface:ScalarArrayremove the topmost element from the array- Specified by:
popin interfaceScalarArray
-
push
public Scalar push(Scalar value)
Description copied from interface:ScalarArrayadd an element onto the end of the array- Specified by:
pushin interfaceScalarArray
-
size
public int size()
Description copied from interface:ScalarArrayreturn the size of the array- Specified by:
sizein interfaceScalarArray
-
sort
public void sort(java.util.Comparator compare)
Description copied from interface:ScalarArraysort this array with the specified comparator- Specified by:
sortin interfaceScalarArray
-
getAt
public Scalar getAt(int index)
Description copied from interface:ScalarArrayget an element at the specified index- Specified by:
getAtin interfaceScalarArray
-
remove
public void remove(Scalar key)
Description copied from interface:ScalarArrayremove all elements with the same identity as the specified scalar- Specified by:
removein interfaceScalarArray
-
remove
public Scalar remove(int index)
Description copied from interface:ScalarArrayremove an element at the specified index- Specified by:
removein interfaceScalarArray
-
scalarIterator
public java.util.Iterator scalarIterator()
Description copied from interface:ScalarArrayreturn an iterator- Specified by:
scalarIteratorin interfaceScalarArray
-
add
public Scalar add(Scalar value, int index)
Description copied from interface:ScalarArrayadd an element to the array at the specified index- Specified by:
addin interfaceScalarArray
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-