Class ConcurrentRecordList
java.lang.Object
com.northconcepts.datapipeline.core.RecordList
com.northconcepts.datapipeline.core.ConcurrentRecordList
- All Implemented Interfaces:
JsonSerializable,RecordSerializable,Serializable,Cloneable,Iterable<Record>
A
RecordList that guards many of its methods with a read-write lock; others, such as size() and
clear(), are unguarded, as are the iterators, streams and lists it hands out.- See Also:
-
Field Summary
Fields inherited from class com.northconcepts.datapipeline.core.RecordList
logFields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPE -
Constructor Summary
ConstructorsConstructorDescriptionConcurrentRecordList(int initialCapacity) ConcurrentRecordList(DataReader reader) ConcurrentRecordList(Record... records) -
Method Summary
Modifier and TypeMethodDescriptionInserts a record at the specified position in this list, shifting any record at or afterindexto the right.Appends all the specified records to the end of this list.addAll(DataReader reader) Writes all the records in the specified reader to the end of this list.clone()Returns a new RecordList that is a copy of this RecordList.Returns a new list with the records the filter allows; the records are shared, not copied.intReturns the index of the first record at or afterfromthat the filter allows, or -1 if none; a negativefromstarts at 0.intReturns the index of the last record at or beforefromthat the filter allows, or -1 if none; afromof -1 or past the end starts at the last record.voidPerforms the given action for each record in this list.get(int index) Returns the record at the specified position in this list.Returns the lock guarding this list, for holding it across several calls or while iterating.intReturns the number of records in this list -- an alias forRecordList.size().Returns a list of records.longReturns the estimated memory used by this list in bytes, counting the first record's field names once for all records.iterator()Returns an iterator over the records in this list.move(int oldIndex, int newIndex) Moves the index field at theoldIndexto thenewIndex, shifting any existing elements at or afternewIndexto the right.Returns a parallel Stream of the records in this list.Replaces the record at the specified position in this list with a new record.sort(RecordComparator comparator) Sorts this list in place with the comparator; the sort is stable.sort(RecordComparator comparator, boolean cacheFieldIndexes) stream()Returns a sequential Stream of the records in this list.sublist(int fromIndex, boolean cloneRecords) sublist(int fromIndex, int toIndex, boolean cloneRecords) Returns a new list with the records fromfromIndex(inclusive) totoIndex(exclusive), cloning each record ifcloneRecordsis true.toString()Methods inherited from class com.northconcepts.datapipeline.core.RecordList
addAll, addAll, clear, count, ensureCapacity, fromArrayValue, fromBinary, fromBinary, fromBinary, fromRecord, getValuesAsArray, getValuesAsArray, getValuesAsArray, isEmpty, isNotEmpty, size, toArrayValue, toBinary, toBinary, toBinary, toDataReader, toRecordMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
spliterator
-
Constructor Details
-
ConcurrentRecordList
public ConcurrentRecordList() -
ConcurrentRecordList
public ConcurrentRecordList(int initialCapacity) -
ConcurrentRecordList
-
ConcurrentRecordList
-
-
Method Details
-
getReadWriteLock
Returns the lock guarding this list, for holding it across several calls or while iterating. -
iterator
Description copied from class:RecordListReturns an iterator over the records in this list.- Specified by:
iteratorin interfaceIterable<Record>- Overrides:
iteratorin classRecordList
-
clone
Description copied from class:RecordListReturns a new RecordList that is a copy of this RecordList.- Overrides:
clonein classRecordList
-
getRecords
Description copied from class:RecordListReturns a list of records.- Overrides:
getRecordsin classRecordList
-
forEach
Description copied from class:RecordListPerforms the given action for each record in this list.- Specified by:
forEachin interfaceIterable<Record>- Overrides:
forEachin classRecordList
-
stream
Description copied from class:RecordListReturns a sequential Stream of the records in this list.- Overrides:
streamin classRecordList
-
parallelStream
Description copied from class:RecordListReturns a parallel Stream of the records in this list.- Overrides:
parallelStreamin classRecordList
-
getRecordCount
public int getRecordCount()Description copied from class:RecordListReturns the number of records in this list -- an alias forRecordList.size().- Overrides:
getRecordCountin classRecordList
-
get
Description copied from class:RecordListReturns the record at the specified position in this list.- Overrides:
getin classRecordList
-
add
Description copied from class:RecordListAppends all the specified records to the end of this list.- Overrides:
addin classRecordList
-
add
Description copied from class:RecordListInserts a record at the specified position in this list, shifting any record at or afterindexto the right.- Overrides:
addin classRecordList
-
set
Description copied from class:RecordListReplaces the record at the specified position in this list with a new record.- Overrides:
setin classRecordList
-
move
Description copied from class:RecordListMoves the index field at theoldIndexto thenewIndex, shifting any existing elements at or afternewIndexto the right.- Overrides:
movein classRecordList
-
addAll
Description copied from class:RecordListWrites all the records in the specified reader to the end of this list.- Overrides:
addAllin classRecordList
-
sublist
Description copied from class:RecordListReturns a new list with the records fromfromIndex(inclusive) totoIndex(exclusive), cloning each record ifcloneRecordsis true.- Overrides:
sublistin classRecordList
-
sublist
- Overrides:
sublistin classRecordList
-
sort
- Overrides:
sortin classRecordList
-
sort
Description copied from class:RecordListSorts this list in place with the comparator; the sort is stable.- Overrides:
sortin classRecordList
-
findFirst
Description copied from class:RecordListReturns the index of the first record at or afterfromthat the filter allows, or -1 if none; a negativefromstarts at 0.- Overrides:
findFirstin classRecordList
-
findLast
Description copied from class:RecordListReturns the index of the last record at or beforefromthat the filter allows, or -1 if none; afromof -1 or past the end starts at the last record.- Overrides:
findLastin classRecordList
-
findAll
Description copied from class:RecordListReturns a new list with the records the filter allows; the records are shared, not copied.- Overrides:
findAllin classRecordList
-
getSizeInBytes
public long getSizeInBytes()Description copied from class:RecordListReturns the estimated memory used by this list in bytes, counting the first record's field names once for all records.- Overrides:
getSizeInBytesin classRecordList
-
toString
- Overrides:
toStringin classRecordList
-