Class HashList<T extends ISimpleElement>
java.lang.Object
org.scictrl.mp.orbitcorrect.model.optics.HashList<T>
- Type Parameters:
T
- element type
- All Implemented Interfaces:
Cloneable
,Iterable<T>
,Collection<T>
,List<T>
,SequencedCollection<T>
- Direct Known Subclasses:
ElementList
This type contain
ArrayList
and HashMap
and enables searching for elements if we know
position in list or hash code. It can contain only ISimpleElement
- Author:
- igor@scictrl.com
- See Also:
-
Constructor Summary
ConstructorDescriptionHashList()
DoubleList default constructor.HashList
(int initialCapacity) Constructor, that require initial capacity.HashList
(int initialCapacity, float loadFactor) Constructor, that require initial capacity and load factor.HashList
(S[] el) This constructor constructDoubleList
fromArrayList
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method add element toDoubleList
on specified location on internalArrayList
boolean
This method add element toDoubleList
boolean
addAll
(int index, Collection<? extends T> c) boolean
addAll
(Collection<? extends T> c) boolean
This method adds all elements fromDoubleList
, taken as a parameter, to thisDoubleList
void
clear()
This method removes all elements from thisDoubleList
clone()
This method return not initialized clone of thisDoubleList
boolean
This method tests, if our list contains object, given as a parameter.boolean
This method tests, if our list containsISimpleElement
, given as a parameter.boolean
containsAll
(Collection<?> c) get
(int index) This method returns reference to element from ourDoubleList
with index, specified by parameter.This method returns reference to element from ourDoubleList
with name, specified by parameter.int
int
indexOf.int
This method returns index of specified element.boolean
isEmpty()
This method tests, if (ArrayList
of) ourDoubleList
is empty.iterator()
This method returns iterator of DoubleList's ArrayList.int
int
lastIndexOf
(T element) lastIndexOf.This method returns ListIterator of DoubleList's ArrayList.listIterator
(int index) This method returns ListIterator of DoubleList's ArrayList, starting at element withindex
.listIterator
(String name) This method returns ListIterator of DoubleList's ArrayList, starting at element eith namename
.listIterator
(ISimpleElement element) This method returns ListIterator of DoubleList's ArrayList, starting at ISimpleElementelement
.remove
(int index) This method removes object whose index isindex
boolean
boolean
Removes object from list.boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) This method removes element at specified positionindex
and put on this position new ISimpleElementelement
.int
size()
This method returns size of this list.void
sort
(Comparator c) This method sortDoubleList
with respect to specified comparator as parameter.subList
(int fromIndex, int toIndex) Object[]
toArray()
This method returns this DoubleList, converted to Array.<U> U[]
toArray
(U[] a) toString()
This method returns string that describeDoubleList
.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.List
addFirst, addLast, equals, getFirst, getLast, hashCode, removeFirst, removeLast, replaceAll, reversed, spliterator
-
Constructor Details
-
HashList
public HashList()DoubleList default constructor. -
HashList
This constructor constructDoubleList
fromArrayList
- Type Parameters:
S
- a S class- Parameters:
el
- an array of S[] objects- Throws:
DataBushInitializationException
- if any.
-
HashList
public HashList(int initialCapacity) Constructor, that require initial capacity.- Parameters:
initialCapacity
- a int
-
HashList
Constructor, that require initial capacity and load factor.- Parameters:
initialCapacity
- a intloadFactor
- a float- Throws:
IllegalArgumentException
- if any.
-
-
Method Details
-
add
This method add element toDoubleList
on specified location on internalArrayList
- Specified by:
add
in interfaceList<T extends ISimpleElement>
-
add
This method add element toDoubleList
- Specified by:
add
in interfaceCollection<T extends ISimpleElement>
- Specified by:
add
in interfaceList<T extends ISimpleElement>
-
addAll
This method adds all elements fromDoubleList
, taken as a parameter, to thisDoubleList
- Parameters:
l
- aHashList
object- Returns:
- a boolean
-
addAll
- Specified by:
addAll
in interfaceCollection<T extends ISimpleElement>
- Specified by:
addAll
in interfaceList<T extends ISimpleElement>
-
addAll
- Specified by:
addAll
in interfaceList<T extends ISimpleElement>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<T extends ISimpleElement>
- Specified by:
containsAll
in interfaceList<T extends ISimpleElement>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<T extends ISimpleElement>
- Specified by:
removeAll
in interfaceList<T extends ISimpleElement>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<T extends ISimpleElement>
- Specified by:
retainAll
in interfaceList<T extends ISimpleElement>
-
clear
public void clear()This method removes all elements from thisDoubleList
- Specified by:
clear
in interfaceCollection<T extends ISimpleElement>
- Specified by:
clear
in interfaceList<T extends ISimpleElement>
-
clone
This method return not initialized clone of thisDoubleList
-
contains
This method tests, if our list contains object, given as a parameter.- Specified by:
contains
in interfaceCollection<T extends ISimpleElement>
- Specified by:
contains
in interfaceList<T extends ISimpleElement>
-
contains
This method tests, if our list containsISimpleElement
, given as a parameter.- Parameters:
l
- a T object- Returns:
- a boolean
-
get
This method returns reference to element from ourDoubleList
with index, specified by parameter.- Specified by:
get
in interfaceList<T extends ISimpleElement>
-
get
This method returns reference to element from ourDoubleList
with name, specified by parameter.- Parameters:
name
- aString
object- Returns:
- a T object
-
indexOf
This method returns index of specified element.- Parameters:
element
- a T object- Returns:
- index of element
-
indexOf
- Specified by:
indexOf
in interfaceList<T extends ISimpleElement>
-
indexOf
indexOf.
- Parameters:
o
- aString
object- Returns:
- a int
-
lastIndexOf
lastIndexOf.
- Parameters:
element
- a T object- Returns:
- a int
-
lastIndexOf
- Specified by:
lastIndexOf
in interfaceList<T extends ISimpleElement>
-
subList
- Specified by:
subList
in interfaceList<T extends ISimpleElement>
-
isEmpty
public boolean isEmpty()This method tests, if (ArrayList
of) ourDoubleList
is empty.- Specified by:
isEmpty
in interfaceCollection<T extends ISimpleElement>
- Specified by:
isEmpty
in interfaceList<T extends ISimpleElement>
-
iterator
This method returns iterator of DoubleList's ArrayList.- Specified by:
iterator
in interfaceCollection<T extends ISimpleElement>
- Specified by:
iterator
in interfaceIterable<T extends ISimpleElement>
- Specified by:
iterator
in interfaceList<T extends ISimpleElement>
- See Also:
-
listIterator
This method returns ListIterator of DoubleList's ArrayList.- Specified by:
listIterator
in interfaceList<T extends ISimpleElement>
- See Also:
-
listIterator
This method returns ListIterator of DoubleList's ArrayList, starting at element withindex
.- Specified by:
listIterator
in interfaceList<T extends ISimpleElement>
- See Also:
-
listIterator
This method returns ListIterator of DoubleList's ArrayList, starting at element eith namename
.- Parameters:
name
- aString
object- Returns:
- a
ListIterator
object - See Also:
-
listIterator
This method returns ListIterator of DoubleList's ArrayList, starting at ISimpleElementelement
.- Parameters:
element
- aISimpleElement
object- Returns:
- a
ListIterator
object - See Also:
-
remove
This method removes object whose index isindex
- Specified by:
remove
in interfaceList<T extends ISimpleElement>
-
remove
Removes object from list.- Parameters:
element
- a T object- Returns:
- a boolean
-
remove
- Specified by:
remove
in interfaceCollection<T extends ISimpleElement>
- Specified by:
remove
in interfaceList<T extends ISimpleElement>
-
set
This method removes element at specified positionindex
and put on this position new ISimpleElementelement
.- Specified by:
set
in interfaceList<T extends ISimpleElement>
-
size
public int size()This method returns size of this list.- Specified by:
size
in interfaceCollection<T extends ISimpleElement>
- Specified by:
size
in interfaceList<T extends ISimpleElement>
-
sort
This method sortDoubleList
with respect to specified comparator as parameter.- Specified by:
sort
in interfaceList<T extends ISimpleElement>
-
toArray
This method returns this DoubleList, converted to Array.- Specified by:
toArray
in interfaceCollection<T extends ISimpleElement>
- Specified by:
toArray
in interfaceList<T extends ISimpleElement>
-
toArray
public <U> U[] toArray(U[] a) toArray.
- Specified by:
toArray
in interfaceCollection<T extends ISimpleElement>
- Specified by:
toArray
in interfaceList<T extends ISimpleElement>
-
toString
This method returns string that describeDoubleList
.
-