Module jonix.common
Package com.tectonica.jonix.common
Class ListOfOnixDataCompositeWithKey<C extends OnixComposite.OnixDataCompositeWithKey<S,K>,S extends JonixKeyedStruct<K>,K extends Enum<K> & OnixCodelist>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.ArrayList<C>
com.tectonica.jonix.common.ListOfOnixDataComposite<C,S>
com.tectonica.jonix.common.ListOfOnixDataCompositeWithKey<C,S,K>
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<C>
,Collection<C>
,List<C>
,RandomAccess
public class ListOfOnixDataCompositeWithKey<C extends OnixComposite.OnixDataCompositeWithKey<S,K>,S extends JonixKeyedStruct<K>,K extends Enum<K> & OnixCodelist>
extends ListOfOnixDataComposite<C,S>
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGiven this list ofOnixComposite.OnixDataCompositeWithKey
s, this method creates a new list containing only a subset of items, or none, conforming to the condition passed in thePredicate
object.Scans the items (i.e.Scans the items (i.e.Scans the items (i.e.findAllAsStructs
(Set<K> structKeys) Same asfindAll(Set)
, but returns aJonixStruct
s rather than the raw ONIX compositesfindAllAsStructs
(K... structKeys) Same asfindAll(Enum[])
, but returns aJonixStruct
rather than the raw ONIX compositeScans the items (i.e.Scans the items (i.e.findAnyAsStruct
(Set<K> structKeys) Same asfindAny(Set)
, but returns aJonixStruct
rather than the raw ONIX compositefindAsStruct
(K structKey) Same asfind(Enum)
, but returns aJonixStruct
rather than the raw ONIX compositefindOrEmpty
(K structKey) Methods inherited from class com.tectonica.jonix.common.ListOfOnixDataComposite
asStructs, first, firstAsStruct, firstOrEmpty, firstOrEmptyAsStruct, structsInto
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, equals, forEach, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll
-
Constructor Details
-
ListOfOnixDataCompositeWithKey
-
-
Method Details
-
itemClass
- Overrides:
itemClass
in classListOfOnixDataComposite<C extends OnixComposite.OnixDataCompositeWithKey<S,
K>, S extends JonixKeyedStruct<K>> - Returns:
- the
Class
of the items in thisList
-
find
Scans the items (i.e. Data Composites) in this list, searching for the one that has the given key- Parameters:
structKey
- the requested key- Returns:
- an
Optional
with the found item (or empty Optional if none exists)
-
findAsStruct
Same asfind(Enum)
, but returns aJonixStruct
rather than the raw ONIX composite -
findAny
Scans the items (i.e. Data Composites) in this list, searching for an arbitrary one whose key is included in the provided set -
findAny
Scans the items (i.e. Data Composites) in this list, searching for an arbitrary one whose key is included in the provided set- Parameters:
structKeys
- set of the requested keys, as arguments list- Returns:
- an
Optional
with the found item (or empty Optional if none exists)
-
findAnyAsStruct
Same asfindAny(Set)
, but returns aJonixStruct
rather than the raw ONIX composite -
findOrEmpty
- Returns:
- the first
OnixComposite.OnixDataCompositeWithKey
listed, if any, or an "empty" instance (whoseOnixTag.exists()
isfalse
), which can be further traversed by your code (as if it exists in the ONIX source), with all underlying data fields eventually yielding "non-existing" value
-
filter
Given this list ofOnixComposite.OnixDataCompositeWithKey
s, this method creates a new list containing only a subset of items, or none, conforming to the condition passed in thePredicate
object.Note that this method is different from
.stream().filter()
in that it returns a list of the same original type (i.e.ListOfOnixDataCompositeWithKey
), and not a generic JavaList
. This allows the caller to apply methods such asListOfOnixDataComposite.firstOrEmpty()
on the returned list.- Overrides:
filter
in classListOfOnixDataComposite<C extends OnixComposite.OnixDataCompositeWithKey<S,
K>, S extends JonixKeyedStruct<K>> - Returns:
- a non-null, possibly empty, sublist of items meeting the predicate condition
-
findAll
Scans the items (i.e. Data Composites) in this list, searching for all of those whose key is included in the provided setNote that this method is different from
.stream().filter()
in that it returns a list of the same original type (i.e.ListOfOnixDataCompositeWithKey
), and not a generic JavaList
. This allows the caller to apply methods such asListOfOnixDataComposite.firstOrEmpty()
on the returned list. -
findAllAsStructs
Same asfindAll(Set)
, but returns aJonixStruct
s rather than the raw ONIX composites -
findAll
Scans the items (i.e. Data Composites) in this list, searching for all of those whose key is included in the provided set- Parameters:
structKeys
- set of the requested keys, as argument list- Returns:
- an
Optional
with the found item (or empty Optional if none exists)
-
findAllAsStructs
Same asfindAll(Enum[])
, but returns aJonixStruct
rather than the raw ONIX composite
-